This commit is contained in:
LZX committed 2026-07-08 22:34:42 +08:00
1 parent f5378eaa38
commit a99646bcd8
2 files changed
+11 -5

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ mod_name=Lzxnone Terraria
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=1.2.1
mod_version=1.2.2
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
@@ -12,6 +12,8 @@ import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.event.entity.living.MobEffectEvent;
import net.neoforged.neoforge.event.tick.EntityTickEvent;
import java.util.Objects;
@EventBusSubscriber(modid = LzxnoneTerraria.MODID)
public class EffectLogicHandler {
@@ -31,8 +33,10 @@ public class EffectLogicHandler {
LivingEntity entity = event.getEntity();
if(!entity.level().isClientSide() && !(entity instanceof Player)) {
if(entity.level() instanceof ServerLevel serverLevel) {
serverLevel.getChunkSource().broadcast(entity,
new ClientboundRemoveMobEffectPacket(entity.getId(), event.getEffectInstance().getEffect()));
if(event.getEffectInstance() != null) {
serverLevel.getChunkSource().broadcast(entity,
new ClientboundRemoveMobEffectPacket(entity.getId(), event.getEffectInstance().getEffect()));
}
}
}
}
@@ -42,8 +46,10 @@ public class EffectLogicHandler {
LivingEntity entity = event.getEntity();
if (!entity.level().isClientSide() && !(entity instanceof Player)) {
if (entity.level() instanceof ServerLevel serverLevel) {
serverLevel.getChunkSource().broadcast(entity,
new ClientboundRemoveMobEffectPacket(entity.getId(), event.getEffectInstance().getEffect()));
if(event.getEffectInstance() != null) {
serverLevel.getChunkSource().broadcast(entity,
new ClientboundRemoveMobEffectPacket(entity.getId(), event.getEffectInstance().getEffect()));
}
}
}
}