优化火炮

This commit is contained in:
Atsuishio 2025-04-02 20:20:52 +08:00 committed by Light_Quanta
parent 30f060320c
commit bf09f6f667
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
3 changed files with 19 additions and 28 deletions

View file

@ -176,6 +176,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
entityData.set(PITCH, Mth.wrapDegrees((float) (-(Mth.atan2(d1, d3) * 57.2957763671875)))); entityData.set(PITCH, Mth.wrapDegrees((float) (-(Mth.atan2(d1, d3) * 57.2957763671875))));
} }
@Override @Override
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) { public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
if (!this.hasPassenger(passenger)) { if (!this.hasPassenger(passenger)) {
@ -193,11 +194,6 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z); callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
} }
@Override
public @NotNull Vec3 getPassengerRidingPosition(@NotNull Entity entity) {
return super.getPassengerRidingPosition(entity).add(0, 0.75, 0);
}
@Override @Override
public DamageModifier getDamageModifier() { public DamageModifier getDamageModifier() {
return super.getDamageModifier() return super.getDamageModifier()

View file

@ -168,23 +168,6 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
entityData.set(YAW, Mth.wrapDegrees((float) (Mth.atan2(d2, d0) * 57.2957763671875) - 90.0F)); entityData.set(YAW, Mth.wrapDegrees((float) (Mth.atan2(d2, d0) * 57.2957763671875) - 90.0F));
} }
@Override
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
if (!this.hasPassenger(passenger)) {
return;
}
Matrix4f transform = getVehicleFlatTransform(1);
float x = 0f;
float y = 2.3f;
float z = 0f;
Vector4f worldPosition = transformPosition(transform, x, y, z);
passenger.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
}
@Override @Override
public DamageModifier getDamageModifier() { public DamageModifier getDamageModifier() {
return super.getDamageModifier() return super.getDamageModifier()
@ -271,6 +254,23 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
this.discard(); this.discard();
} }
@Override
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
if (!this.hasPassenger(passenger)) {
return;
}
Matrix4f transform = getVehicleFlatTransform(1);
float x = 0f;
float y = 2.3f;
float z = 0f;
Vector4f worldPosition = transformPosition(transform, x, y, z);
passenger.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
}
@Override @Override
public void vehicleShoot(Player player, int type) { public void vehicleShoot(Player player, int type) {
if (this.entityData.get(COOL_DOWN) > 0) return; if (this.entityData.get(COOL_DOWN) > 0) return;

View file

@ -176,7 +176,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
return 2.16F; return 2.16F;
} }
@Override
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) { public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
if (!this.hasPassenger(passenger)) { if (!this.hasPassenger(passenger)) {
return; return;
@ -193,11 +193,6 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z); callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
} }
@Override
public @NotNull Vec3 getPassengerRidingPosition(@NotNull Entity entity) {
return super.getPassengerRidingPosition(entity).add(0, -0.075, 0);
}
@Override @Override
public DamageModifier getDamageModifier() { public DamageModifier getDamageModifier() {
return super.getDamageModifier() return super.getDamageModifier()