优化载具

This commit is contained in:
Atsuihsio 2024-12-28 16:56:17 +08:00
parent 2db63de858
commit 74d953a8ec
3 changed files with 9 additions and 11 deletions

View file

@ -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);

View file

@ -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 {

View file

@ -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);
}