From 7736e8264f3c956b537818e56ae9dda17660bf04 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Fri, 11 Apr 2025 17:05:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9D=A6=E5=85=8B=E4=B8=89?= =?UTF-8?q?=E5=8F=B7=E4=BD=8D=E4=BD=BF=E7=94=A8=E8=87=AA=E8=BA=AB=E6=AD=A6?= =?UTF-8?q?=E5=99=A8=E6=83=85=E5=86=B5=E4=B8=8B=E6=98=BE=E7=A4=BA=E8=BD=BD?= =?UTF-8?q?=E5=85=B7=E6=AD=A6=E5=99=A8=E7=9A=84bug=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E9=94=81=E5=AE=9A=E8=87=AA=E5=B7=B1=E7=9A=84=E8=9C=82?= =?UTF-8?q?=E7=BE=A4=E6=97=A0=E4=BA=BA=E6=9C=BAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/overlay/VehicleHudOverlay.java | 6 ++++-- .../entity/projectile/SwarmDroneEntity.java | 18 ++++++++++-------- .../entity/vehicle/Yx100Entity.java | 2 +- .../superbwarfare/tools/SeekTool.java | 13 +++++-------- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java index acb1a5076..6fc1fcf38 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/VehicleHudOverlay.java @@ -357,12 +357,14 @@ public class VehicleHudOverlay implements LayeredDraw.Layer { } private static void renderWeaponInfo(GuiGraphics guiGraphics, VehicleEntity vehicle, int w, int h) { - if (!(vehicle instanceof WeaponVehicleEntity weaponVehicle)) return; + Player player = Minecraft.getInstance().player; + + if (!(vehicle instanceof WeaponVehicleEntity weaponVehicle && weaponVehicle.banHand(player))) return; var temp = wasRenderingWeapons; wasRenderingWeapons = false; - Player player = Minecraft.getInstance().player; + assert player != null; int index = vehicle.getSeatIndex(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 08460d78e..89a829ad4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SwarmDroneEntity.java @@ -166,6 +166,13 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti if (result.getEntity() instanceof SwarmDroneEntity) { 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); + + PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5)); + } + } if (this.level() instanceof ServerLevel) { causeMissileExplode(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), this.explosionDamage, this.explosionRadius); } @@ -198,6 +205,9 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti if (guide_type == 0 && entity != null) { targetPos = entity.getEyePosition(); + this.entityData.set(TARGET_X, (float) targetPos.x); + this.entityData.set(TARGET_Y, (float) targetPos.y); + this.entityData.set(TARGET_Z, (float) targetPos.z); } else { targetPos = new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y), this.entityData.get(TARGET_Z)); } @@ -235,14 +245,6 @@ public class SwarmDroneEntity extends FastThrowableProjectile implements GeoEnti } public void causeMissileExplode(@Nullable DamageSource source, float damage, float radius) { - 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); - - PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5)); - } - } - CustomExplosion explosion = new CustomExplosion(level(), this, source, damage, this.getX(), this.getY(), this.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f); explosion.explode(); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index 875cab936..6b1ffe9ea 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -649,7 +649,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti swarmDroneEntity.setPos(worldPosition.x, worldPosition.y, worldPosition.z); swarmDroneEntity.shoot(direct.x, direct.y, direct.z, 1.2f, 10); - if (lookingEntity != null) { + if (lookingEntity != null && !(lookingEntity instanceof SwarmDroneEntity swarmDrone && swarmDrone.getOwner() == player)) { swarmDroneEntity.setGuideType(0); swarmDroneEntity.setTargetUuid(lookingEntity.getStringUUID()); swarmDroneEntity.setTargetVec(lookingEntity.getEyePosition()); diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java index d854699c6..8f3418748 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java @@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.config.server.VehicleConfig; import com.atsuishio.superbwarfare.entity.ClaymoreEntity; import com.atsuishio.superbwarfare.entity.projectile.C4Entity; import com.atsuishio.superbwarfare.entity.projectile.DestroyableProjectileEntity; +import com.atsuishio.superbwarfare.entity.projectile.SwarmDroneEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import net.minecraft.core.BlockPos; @@ -69,14 +70,10 @@ public class SeekTool { && e != entity && baseFilter(e) && e.getVehicle() == null - && (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM")) - ) { - return level.clip(new ClipContext( - entity.getEyePosition(), - e.getEyePosition(), - ClipContext.Block.COLLIDER, - ClipContext.Fluid.NONE, entity) - ).getType() != HitResult.Type.BLOCK; + && !(e instanceof SwarmDroneEntity swarmDrone && swarmDrone.getOwner() != entity) + && (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) { + return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(), + ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK; } return false; })