From a39ecda5d82e2f4fcae9b6882e3aa7215bf1aab1 Mon Sep 17 00:00:00 2001 From: 17146 <1714673995@qq.com> Date: Tue, 24 Jun 2025 01:52:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/event/LivingEventHandler.java | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 43e12a8b5..c901494a7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -61,12 +61,8 @@ public class LivingEventHandler { public static void onEntityAttacked(LivingIncomingDamageEvent event) { if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION) && event.getEntity().getVehicle() instanceof VehicleEntity vehicle) { if (event.getEntity().getVehicle() instanceof ArmedVehicleEntity iArmedVehicle && iArmedVehicle.hidePassenger(event.getEntity())) { - if (!(event.getSource().is(DamageTypes.EXPLOSION) - || event.getSource().is(DamageTypes.PLAYER_EXPLOSION) - || event.getSource().is(ModDamageTypes.CUSTOM_EXPLOSION) - || event.getSource().is(ModDamageTypes.MINE) - || event.getSource().is(ModDamageTypes.PROJECTILE_BOOM))) { - vehicle.hurt(event.getSource(), event.getContainer().getOriginalDamage()); + if (!event.getSource().is(ModTags.DamageTypes.VEHICLE_NOT_ABSORB)) { + vehicle.hurt(event.getSource(), event.getAmount()); } event.setCanceled(true); } @@ -146,10 +142,8 @@ public class LivingEventHandler { var tag = NBTTool.getTag(armor); if (armor != ItemStack.EMPTY && tag.contains("ArmorPlate")) { - double armorValue; - armorValue = tag.getDouble("ArmorPlate"); + double armorValue = tag.getDouble("ArmorPlate"); tag.putDouble("ArmorPlate", Math.max(armorValue - damage, 0)); - NBTTool.saveTag(armor, tag); damage = Math.max(damage - armorValue, 0); } @@ -428,10 +422,7 @@ public class LivingEventHandler { } private static void stopGunReloadSound(ServerPlayer player, GunItem gun) { - gun.getReloadSound().forEach(sound -> { - var clientboundstopsoundpacket = new ClientboundStopSoundPacket(sound.getLocation(), SoundSource.PLAYERS); - player.connection.send(clientboundstopsoundpacket); - }); + gun.getReloadSound().forEach(sound -> player.connection.send(new ClientboundStopSoundPacket(sound.getLocation(), SoundSource.PLAYERS))); } /**