调整撞击伤害和载具交互
This commit is contained in:
parent
bf31a3946a
commit
c3fdfa6eb7
2 changed files with 18 additions and 8 deletions
|
@ -141,8 +141,8 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity {
|
||||||
if (this instanceof HelicopterEntity) {
|
if (this instanceof HelicopterEntity) {
|
||||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (20 * ((lastTickSpeed - 0.3) * (lastTickSpeed - 0.3))));
|
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (20 * ((lastTickSpeed - 0.3) * (lastTickSpeed - 0.3))));
|
||||||
this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
this.bounceVertical(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
||||||
} else if (Mth.abs((float) lastTickVerticalSpeed) > 0.6) {
|
} else if (Mth.abs((float) lastTickVerticalSpeed) > 0.4) {
|
||||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (48 * ((Mth.abs((float) lastTickVerticalSpeed) - 0.6) * (lastTickSpeed - 0.4) * (lastTickSpeed - 0.4))));
|
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (96 * ((Mth.abs((float) lastTickVerticalSpeed) - 0.4) * (lastTickSpeed - 0.3) * (lastTickSpeed - 0.3))));
|
||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.horizontalCollision) {
|
if (this.horizontalCollision) {
|
||||||
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (36 * ((lastTickSpeed - 0.4) * (lastTickSpeed - 0.4))));
|
this.hurt(ModDamageTypes.causeVehicleStrikeDamage(this.level().registryAccess(), this, driver == null ? this : driver), (float) (126 * ((lastTickSpeed - 0.4) * (lastTickSpeed - 0.4))));
|
||||||
this.bounceHorizontal(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
this.bounceHorizontal(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
||||||
if (!this.level().isClientSide) {
|
if (!this.level().isClientSide) {
|
||||||
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
this.level().playSound(null, this, ModSounds.VEHICLE_STRIKE.get(), this.getSoundSource(), 1, 1);
|
||||||
|
|
|
@ -263,14 +263,24 @@ public abstract class VehicleEntity extends Entity {
|
||||||
} else if (!player.isShiftKeyDown()) {
|
} else if (!player.isShiftKeyDown()) {
|
||||||
if (this.getFirstPassenger() == null) {
|
if (this.getFirstPassenger() == null) {
|
||||||
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
||||||
player.setXRot(this.getXRot());
|
if (this instanceof LandArmorEntity landArmorEntity) {
|
||||||
player.setYRot(this.getYRot());
|
player.setXRot((float) getXRotFromVector(landArmorEntity.getBarrelVec(1)));
|
||||||
|
player.setYRot((float) getYRotFromVector(landArmorEntity.getBarrelVec(1)));
|
||||||
|
} else {
|
||||||
|
player.setXRot(this.getXRot());
|
||||||
|
player.setYRot(this.getYRot());
|
||||||
|
}
|
||||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||||
} else if (!(this.getFirstPassenger() instanceof Player)) {
|
} else if (!(this.getFirstPassenger() instanceof Player)) {
|
||||||
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
if (player instanceof FakePlayer) return InteractionResult.PASS;
|
||||||
this.getFirstPassenger().stopRiding();
|
this.getFirstPassenger().stopRiding();
|
||||||
player.setXRot(this.getXRot());
|
if (this instanceof LandArmorEntity landArmorEntity) {
|
||||||
player.setYRot(this.getYRot());
|
player.setXRot((float) getXRotFromVector(landArmorEntity.getBarrelVec(1)));
|
||||||
|
player.setYRot((float) getYRotFromVector(landArmorEntity.getBarrelVec(1)));
|
||||||
|
} else {
|
||||||
|
player.setXRot(this.getXRot());
|
||||||
|
player.setYRot(this.getYRot());
|
||||||
|
}
|
||||||
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
return player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
|
||||||
}
|
}
|
||||||
if (this.canAddPassenger(player)) {
|
if (this.canAddPassenger(player)) {
|
||||||
|
@ -352,7 +362,7 @@ public abstract class VehicleEntity extends Entity {
|
||||||
.immuneTo(DamageTypes.DRAGON_BREATH)
|
.immuneTo(DamageTypes.DRAGON_BREATH)
|
||||||
.immuneTo(DamageTypes.WITHER)
|
.immuneTo(DamageTypes.WITHER)
|
||||||
.immuneTo(DamageTypes.WITHER_SKULL)
|
.immuneTo(DamageTypes.WITHER_SKULL)
|
||||||
.reduce(8, ModDamageTypes.VEHICLE_STRIKE);
|
.reduce(5, ModDamageTypes.VEHICLE_STRIKE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void heal(float pHealAmount) {
|
public void heal(float pHealAmount) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue