微调小鸟升降机动性和调整部分载具第三人称手持武器瞄准视角

This commit is contained in:
Atsuihsio 2025-02-09 12:26:55 +08:00
parent e23b04aeba
commit e6093a6dee
2 changed files with 18 additions and 10 deletions

View file

@ -86,6 +86,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
public int heat;
public int holdTick;
public int holdPowerTick;
public Ah6Entity(PlayMessages.SpawnEntity packet, Level world) {
this(ModEntities.AH_6.get(), world);
@ -333,14 +334,17 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
}
if (up && engineStartOver) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.005f, 0.12f));
holdPowerTick++;
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0007f * Math.min(holdPowerTick, 10), 0.12f));
}
if (engineStartOver) {
if (down) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0036f, this.onGround() ? 0 : 0.01f));
holdPowerTick++;
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0004f * Math.min(holdPowerTick, 10), this.onGround() ? 0 : 0.01f));
} else if (backInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0036f, this.onGround() ? 0 : 0.052f));
holdPowerTick++;
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0004f * Math.min(holdPowerTick, 10), this.onGround() ? 0 : 0.052f));
if (passenger != null) {
passenger.setXRot(0.8f * passenger.getXRot());
}
@ -353,10 +357,11 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
if (!(up || down || backInputDown) && engineStartOver) {
if (this.getDeltaMovement().y() < 0) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.00005f, 0.12f));
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.0002f, 0.12f));
} else {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.onGround() ? 0.00005f : 0.00006f), 0));
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.onGround() ? 0.00005f : 0.0002f), 0));
}
holdPowerTick = 0;
}
} else {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0001f, 0));

View file

@ -26,6 +26,8 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static com.atsuishio.superbwarfare.event.ClientEventHandler.zoom;
@Mixin(Camera.class)
public abstract class CameraMixin {
@ -122,6 +124,12 @@ public abstract class CameraMixin {
@Inject(method = "setup", at = @At("TAIL"))
public void ia$setup(BlockGetter area, Entity entity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && entity instanceof Player player && player.getMainHandItem().is(ModTags.Items.GUN) && zoom) {
move(-getMaxZoom(-2.9 * Math.max(ClientEventHandler.pullPos, ClientEventHandler.zoomPos)), 0, -ClientEventHandler.cameraLocation * Math.max(ClientEventHandler.pullPos, ClientEventHandler.zoomPos));
return;
}
if (thirdPerson && entity.getVehicle() instanceof Mk42Entity) {
move(-getMaxZoom(8), 1, 0.0);
return;
@ -155,12 +163,7 @@ public abstract class CameraMixin {
if (thirdPerson && entity.getVehicle() instanceof Bmp2Entity && !ClientEventHandler.zoomVehicle) {
move(-getMaxZoom(3), 1, 0.0);
return;
}
if (Minecraft.getInstance().options.getCameraType() == CameraType.THIRD_PERSON_BACK && entity instanceof Player player && player.getMainHandItem().is(ModTags.Items.GUN)) {
move(-getMaxZoom(-2.9 * Math.max(ClientEventHandler.pullPos, ClientEventHandler.zoomPos)), 0, -ClientEventHandler.cameraLocation * Math.max(ClientEventHandler.pullPos, ClientEventHandler.zoomPos));
}
}
@Shadow