diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index aad910b03..663e5940e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -47,6 +47,7 @@ import net.minecraft.world.level.GameRules; import net.minecraft.world.level.block.entity.HopperBlockEntity; import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.fml.common.EventBusSubscriber; +import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.util.TriState; import net.neoforged.neoforge.event.entity.living.*; import net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent; @@ -308,10 +309,9 @@ public class LivingEventHandler { } if (!sourceEntity.level().isClientSide() && sourceEntity instanceof ServerPlayer player) { - // TODO 判断 pre kill event 结果 -// if (NeoForge.EVENT_BUS.post(new PreKillEvent.Indicator(player, source, event.getEntity()))) { -// return; -// } + if (NeoForge.EVENT_BUS.post(new PreKillEvent.Indicator(player, source, event.getEntity())).isCanceled()) { + return; + } SoundTool.playLocalSound(player, ModSounds.TARGET_DOWN.get(), 3f, 1f); PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(2, 8)); @@ -469,10 +469,9 @@ public class LivingEventHandler { attacker = player; } - // TODO pre kill event -// if (NeoForge.EVENT_BUS.post(new PreKillEvent.SendKillMessage(attacker, source, entity))) { -// return; -// } + if (NeoForge.EVENT_BUS.post(new PreKillEvent.SendKillMessage(attacker, source, entity)).isCanceled()) { + return; + } if (attacker != null && MiscConfig.SEND_KILL_FEEDBACK.get()) { if (DamageTypeTool.isHeadshotDamage(source)) { diff --git a/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/box/AmmoBox.java b/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/box/AmmoBox.java index 5c21d8f0e..721d9b009 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/box/AmmoBox.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/common/ammo/box/AmmoBox.java @@ -29,7 +29,6 @@ public class AmmoBox extends Item { super(new Properties().stacksTo(1)); } - // TODO 修复弹药存储问题 @Override public @NotNull InteractionResultHolder use(@NotNull Level level, Player player, @NotNull InteractionHand hand) { ItemStack stack = player.getItemInHand(hand);