From 74d953a8ec3e4540ee6bf2c2e13755acb18b7f52 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Sat, 28 Dec 2024 16:56:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BD=BD=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/MobileVehicleEntity.java | 10 +++++----- .../superbwarfare/entity/SpeedboatEntity.java | 3 --- .../superbwarfare/entity/WheelChairEntity.java | 7 ++++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/MobileVehicleEntity.java index 769ecec09..15c079e5e 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/MobileVehicleEntity.java @@ -4,9 +4,9 @@ import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModSounds; import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.projectile.Projectile; import net.minecraft.world.level.Level; @@ -31,9 +31,9 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { @Override public void baseTick() { super.baseTick(); - if (this.level() instanceof ServerLevel) { - crushEntities(this.getDeltaMovement()); - } + crushEntities(this.getDeltaMovement()); + + this.move(MoverType.SELF, this.getDeltaMovement()); this.refreshDimensions(); } @@ -51,7 +51,7 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { double f = Math.min(entitySize / thisSize, 2); double f1 = Math.min(thisSize / entitySize, 4); - if (entity.isAlive() && !(entity instanceof ItemEntity || entity instanceof Projectile || entity instanceof ProjectileEntity)) { + if (entity.isAlive() && entity.getVehicle() == null && !(entity instanceof ItemEntity || entity instanceof Projectile || entity instanceof ProjectileEntity)) { if (velocity.horizontalDistance() > 0.5) { if (!this.level().isClientSide) { this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java index 0120e338a..49b9646df 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/SpeedboatEntity.java @@ -39,7 +39,6 @@ import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.HasCustomInventoryScreen; -import net.minecraft.world.entity.MoverType; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; @@ -225,8 +224,6 @@ public class SpeedboatEntity extends MobileVehicleEntity implements GeoEntity, I fluidFloat = -0.05 + 0.1 * getSubmergedHeight(this); this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0)); - this.move(MoverType.SELF, this.getDeltaMovement()); - if (this.onGround()) { this.setDeltaMovement(this.getDeltaMovement().multiply(0.2, 0.85, 0.2)); } else { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/WheelChairEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/WheelChairEntity.java index aca7205fb..f385657b3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/WheelChairEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/WheelChairEntity.java @@ -17,7 +17,10 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityDimensions; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Pose; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; @@ -110,8 +113,6 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity, this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.95, 0.99)); } - this.move(MoverType.SELF, this.getDeltaMovement()); - if (level().isClientSide && this.getEnergy() > 0) { level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), ModSounds.WHEEL_CHAIR_ENGINE.get(), this.getSoundSource(), (float) (0.2 * this.getDeltaMovement().length()), (random.nextFloat() * 0.1f + 0.7f), false); }