微调小鸟升降机动性和调整部分载具第三人称手持武器瞄准视角
This commit is contained in:
parent
e23b04aeba
commit
e6093a6dee
2 changed files with 18 additions and 10 deletions
|
@ -86,6 +86,7 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
public int heat;
|
public int heat;
|
||||||
|
|
||||||
public int holdTick;
|
public int holdTick;
|
||||||
|
public int holdPowerTick;
|
||||||
|
|
||||||
public Ah6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
public Ah6Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
this(ModEntities.AH_6.get(), world);
|
this(ModEntities.AH_6.get(), world);
|
||||||
|
@ -333,14 +334,17 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
}
|
}
|
||||||
|
|
||||||
if (up && engineStartOver) {
|
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 (engineStartOver) {
|
||||||
if (down) {
|
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) {
|
} 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) {
|
if (passenger != null) {
|
||||||
passenger.setXRot(0.8f * passenger.getXRot());
|
passenger.setXRot(0.8f * passenger.getXRot());
|
||||||
}
|
}
|
||||||
|
@ -353,10 +357,11 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
|
|
||||||
if (!(up || down || backInputDown) && engineStartOver) {
|
if (!(up || down || backInputDown) && engineStartOver) {
|
||||||
if (this.getDeltaMovement().y() < 0) {
|
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 {
|
} 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 {
|
} else {
|
||||||
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0001f, 0));
|
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0001f, 0));
|
||||||
|
|
|
@ -26,6 +26,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import static com.atsuishio.superbwarfare.event.ClientEventHandler.zoom;
|
||||||
|
|
||||||
@Mixin(Camera.class)
|
@Mixin(Camera.class)
|
||||||
public abstract class CameraMixin {
|
public abstract class CameraMixin {
|
||||||
|
|
||||||
|
@ -122,6 +124,12 @@ public abstract class CameraMixin {
|
||||||
|
|
||||||
@Inject(method = "setup", at = @At("TAIL"))
|
@Inject(method = "setup", at = @At("TAIL"))
|
||||||
public void ia$setup(BlockGetter area, Entity entity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) {
|
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) {
|
if (thirdPerson && entity.getVehicle() instanceof Mk42Entity) {
|
||||||
move(-getMaxZoom(8), 1, 0.0);
|
move(-getMaxZoom(8), 1, 0.0);
|
||||||
return;
|
return;
|
||||||
|
@ -155,12 +163,7 @@ public abstract class CameraMixin {
|
||||||
|
|
||||||
if (thirdPerson && entity.getVehicle() instanceof Bmp2Entity && !ClientEventHandler.zoomVehicle) {
|
if (thirdPerson && entity.getVehicle() instanceof Bmp2Entity && !ClientEventHandler.zoomVehicle) {
|
||||||
move(-getMaxZoom(3), 1, 0.0);
|
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
|
@Shadow
|
||||||
|
|
Loading…
Add table
Reference in a new issue