From a166421d5c0f4a44e4af5054cc81a81747bd23d8 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Mon, 16 Jun 2025 14:09:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=B9=E5=B0=84=E7=89=A9?= =?UTF-8?q?=E6=89=93=E5=88=B0=E8=87=AA=E5=B7=B1=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/projectile/Agm65Entity.java | 2 ++ .../superbwarfare/entity/projectile/CannonShellEntity.java | 2 ++ .../superbwarfare/entity/projectile/GunGrenadeEntity.java | 2 ++ .../superbwarfare/entity/projectile/HeliRocketEntity.java | 3 ++- .../entity/projectile/JavelinMissileEntity.java | 3 ++- .../superbwarfare/entity/projectile/RgoGrenadeEntity.java | 2 ++ .../superbwarfare/entity/projectile/RpgRocketEntity.java | 3 ++- .../entity/projectile/SmallCannonShellEntity.java | 3 +++ .../superbwarfare/entity/projectile/SwarmDroneEntity.java | 5 ++++- .../superbwarfare/entity/projectile/TaserBulletEntity.java | 3 ++- .../superbwarfare/entity/projectile/WgMissileEntity.java | 3 ++- .../superbwarfare/entity/vehicle/SpeedboatEntity.java | 2 +- 12 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java index ef1a32108..22d2b07fb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/Agm65Entity.java @@ -145,6 +145,8 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, E @Override protected void onHitEntity(EntityHitResult result) { Entity entity = result.getEntity(); + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.level() instanceof ServerLevel && tickCount > 8) { if (entity == this.getOwner() || (this.getOwner() != null && entity == this.getOwner().getVehicle())) return; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java index 9972bd567..73c246c7c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java @@ -146,6 +146,8 @@ public class CannonShellEntity extends FastThrowableProjectile implements GeoEnt public void onHitEntity(@NotNull EntityHitResult entityHitResult) { if (this.level() instanceof ServerLevel) { Entity entity = entityHitResult.getEntity(); + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage); if (entity instanceof LivingEntity) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/GunGrenadeEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/GunGrenadeEntity.java index 0704dcaa2..5f90a7ff5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/GunGrenadeEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/GunGrenadeEntity.java @@ -114,6 +114,8 @@ public class GunGrenadeEntity extends FastThrowableProjectile implements GeoEnti protected void onHitEntity(EntityHitResult result) { float damageMultiplier = 1 + this.monsterMultiplier; Entity entity = result.getEntity(); + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java index a05e2dcdf..e83e238ba 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java @@ -93,7 +93,8 @@ public class HeliRocketEntity extends FastThrowableProjectile implements GeoEnti @Override protected void onHitEntity(EntityHitResult result) { Entity entity = result.getEntity(); - if (entity == this.getOwner() || entity == this.getVehicle()) return; + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java index 887d6e5a7..1426abe56 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java @@ -173,7 +173,8 @@ public class JavelinMissileEntity extends FastThrowableProjectile implements Geo protected void onHitEntity(EntityHitResult result) { float damageMultiplier = 1 + this.monsterMultiplier; Entity entity = result.getEntity(); - if (entity == this.getOwner() || entity == this.getVehicle()) return; + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RgoGrenadeEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RgoGrenadeEntity.java index 8fb905821..25c6947c7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RgoGrenadeEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RgoGrenadeEntity.java @@ -100,6 +100,8 @@ public class RgoGrenadeEntity extends FastThrowableProjectile implements GeoEnti case ENTITY: EntityHitResult entityResult = (EntityHitResult) result; Entity entity = entityResult.getEntity(); + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java index 1a3867555..89734802f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/RpgRocketEntity.java @@ -128,7 +128,8 @@ public class RpgRocketEntity extends FastThrowableProjectile implements GeoEntit protected void onHitEntity(EntityHitResult result) { float damageMultiplier = 1 + this.monsterMultiplier; Entity entity = result.getEntity(); - if (entity == this.getOwner() || entity == this.getVehicle()) return; + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java index 9e1742226..eb1a2d3a3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java @@ -96,6 +96,9 @@ public class SmallCannonShellEntity extends FastThrowableProjectile implements G @Override protected void onHitEntity(@NotNull EntityHitResult result) { Entity entity = result.getEntity(); + + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.level() instanceof ServerLevel) { if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java index c64e64ab9..97f3190f9 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java @@ -179,9 +179,12 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti @Override protected void onHitEntity(@NotNull EntityHitResult result) { - if (result.getEntity() instanceof SwarmDroneEntity) { + Entity entity = result.getEntity(); + if (entity instanceof SwarmDroneEntity) { return; } + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/TaserBulletEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/TaserBulletEntity.java index 7972f1e23..8a67ca26f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/TaserBulletEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/TaserBulletEntity.java @@ -103,7 +103,8 @@ public class TaserBulletEntity extends AbstractArrow implements GeoEntity { @Override protected void onHitEntity(EntityHitResult result) { Entity entity = result.getEntity(); - if (entity == this.getVehicle()) return; + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java index 253afe34b..6eb5dacbf 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/WgMissileEntity.java @@ -136,7 +136,8 @@ public class WgMissileEntity extends FastThrowableProjectile implements GeoEntit protected void onHitEntity(EntityHitResult result) { Entity entity = result.getEntity(); if (this.tickCount < 1) return; - if (entity == this.getOwner() || entity == this.getVehicle()) return; + if (this.getOwner() != null && this.getOwner().getVehicle() != null && entity == this.getOwner().getVehicle()) + return; if (this.getOwner() instanceof LivingEntity living) { if (!living.level().isClientSide() && living instanceof ServerPlayer player) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java index c1baaa353..b52ae1abd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/SpeedboatEntity.java @@ -59,7 +59,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo public SpeedboatEntity(EntityType type, Level world) { super(type, world); this.obb = new OBB(this.position().toVector3f(), new Vector3f(1.5625f, 0.75f, 3.1875f), new Quaternionf(), false); - this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(1.0625f, 0.5f, 1.90625f), new Quaternionf(), true); + this.obb2 = new OBB(this.position().toVector3f(), new Vector3f(1.0625f, 0.5f, 1.90625f), new Quaternionf(), false); } @Override