修复载具在客户端被攻击的虚假扣血,修复直升机功率条同步问题
This commit is contained in:
parent
4247ca342a
commit
c395abd0df
3 changed files with 21 additions and 14 deletions
|
@ -79,7 +79,7 @@ public class HelicopterHudOverlay {
|
|||
|
||||
float power = iHelicopterEntity.getPower();
|
||||
lerpPower = Mth.lerp(0.001f * event.getPartialTick(), lerpPower, power);
|
||||
preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 900), 0, 0, 4, power * 900, 4, power * 900);
|
||||
preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/helicopter/heli_power.png"), (float) w / 2 + 130f, ((float) h / 2 - 64 + 124 - power * 970), 0, 0, 4, power * 970, 4, power * 970);
|
||||
lerpVy = (float) Mth.lerp(0.021f * event.getPartialTick(), lerpVy, mobileVehicle.getDeltaMovement().y() + 0.06f);
|
||||
preciseBlit(event.getGuiGraphics(), ModUtils.loc("textures/screens/helicopter/heli_vy_move.png"), (float) w / 2 + 100, ((float) h / 2 - 64 - Math.max(lerpVy, 0) * 100f), 0, 0, 64, 128, 64, 128);
|
||||
event.getGuiGraphics().drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(mobileVehicle.getY())),
|
||||
|
|
|
@ -131,6 +131,7 @@ public class Ah6Entity extends MobileVehicleEntity implements GeoEntity, IHelico
|
|||
this.setXRot(Mth.clamp(this.getXRot() + (this.onGround() ? 0 : 1.2f) * diffX * this.entityData.get(POWER), -80, 80));
|
||||
this.setZRot(Mth.clamp(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.75f) * diffY * this.entityData.get(POWER), -50, 50));
|
||||
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
if (this.upInputDown || this.forwardInputDown) {
|
||||
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.002f, 0.12f));
|
||||
}
|
||||
|
@ -149,6 +150,7 @@ public class Ah6Entity extends MobileVehicleEntity implements GeoEntity, IHelico
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
|
||||
|
||||
|
|
|
@ -161,12 +161,17 @@ public class VehicleEntity extends Entity {
|
|||
}
|
||||
|
||||
public void heal(float pHealAmount) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
this.setHealth(this.getHealth() + pHealAmount);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void hurt(float pHealAmount) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
this.setHealth(this.getHealth() - pHealAmount);
|
||||
}
|
||||
}
|
||||
|
||||
public float getHealth() {
|
||||
return this.entityData.get(HEALTH);
|
||||
|
|
Loading…
Add table
Reference in a new issue