优化lavHUD,优化视角
This commit is contained in:
parent
57653ff0a0
commit
c4aa45fb32
10 changed files with 34 additions and 13 deletions
|
@ -6,6 +6,7 @@ import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.CameraType;
|
import net.minecraft.client.CameraType;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
@ -65,11 +66,19 @@ public class LandArmorHudOverlay {
|
||||||
int addW = (w / h) * 48;
|
int addW = (w / h) * 48;
|
||||||
int addH = (w / h) * 27;
|
int addH = (w / h) * 27;
|
||||||
preciseBlit(guiGraphics, FRAME, (float) -addW / 2, (float) -addH / 2, 10, 0, 0.0F, w + addW, h + addH, w + addW, h + addH);
|
preciseBlit(guiGraphics, FRAME, (float) -addW / 2, (float) -addH / 2, 10, 0, 0.0F, w + addW, h + addH, w + addW, h + addH);
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/heli_base.png"), k, l, 0, 0.0F, i, j, i, j);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/land/lav_cross.png"), k, l, 0, 0.0F, i, j, i, j);
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/compass.png"), (float) w / 2 - 128, (float) 6, 128 + ((float) 64 / 45 * player.getYRot()), 0, 256, 16, 512, 16);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/compass.png"), (float) w / 2 - 128, (float) 10, 128 + ((float) 64 / 45 * player.getYRot()), 0, 256, 16, 512, 16);
|
||||||
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/speed_frame.png"), (float) w / 2 - 144, (float) h / 2 - 6, 0, 0, 50, 18, 50, 18);
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/helicopter/roll_ind.png"), w / 2 - 8, 30, 0, 0.0F, 16, 16, 16, 16);
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/land/line.png"), w / 2 - 64, h - 56, 0, 0.0F, 128, 1, 128, 1);
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/land/line.png"), w / 2 + 112, h - 71, 0, 0.0F, 1, 16, 1, 16);
|
||||||
|
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(event.getPartialTick(), lav150.turretYRotO, lav150.getTurretYRot())),w / 2 + 112, h - 56, 0);
|
||||||
|
preciseBlit(guiGraphics, ModUtils.loc("textures/screens/land/body.png"), w / 2 + 96, h - 72, 0, 0.0F, 32, 32, 32, 32);
|
||||||
|
poseStack.popPose();
|
||||||
|
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(lav150.getDeltaMovement().length() * 72) + " KM/H"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal(new DecimalFormat("##").format(lav150.getDeltaMovement().length() * 72) + " KM/H"),
|
||||||
w / 2 - 140, h / 2, 0x66FF00, false);
|
w / 2 + 160, h / 2 - 48, 0x66FF00, false);
|
||||||
if (lav150.getEnergy() < 0.02 * lav150.getMaxEnergy()) {
|
if (lav150.getEnergy() < 0.02 * lav150.getMaxEnergy()) {
|
||||||
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("NO POWER!"),
|
guiGraphics.drawString(Minecraft.getInstance().font, Component.literal("NO POWER!"),
|
||||||
w / 2 - 144, h / 2 + 14, -65536, false);
|
w / 2 - 144, h / 2 + 14, -65536, false);
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
|
||||||
entity.invulnerableTime = 0;
|
entity.invulnerableTime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.tickCount > 1) {
|
if (this.tickCount > 0) {
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
causeExplode(result);
|
causeExplode(result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,12 +375,12 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
float diffY;
|
float diffY;
|
||||||
float diffX;
|
float diffX;
|
||||||
|
|
||||||
diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.1f);
|
diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.05f);
|
||||||
diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot());
|
diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot());
|
||||||
|
|
||||||
|
|
||||||
this.setTurretXRot(Mth.clamp(this.getTurretXRot() + Mth.clamp(0.5f * diffX, -2, 2), -25, 10));
|
this.setTurretXRot(Mth.clamp(this.getTurretXRot() + Mth.clamp(0.95f * diffX, -5, 5), -32.5f, 15));
|
||||||
this.setTurretYRot(this.getTurretYRot() + Mth.clamp(0.5f * diffY, -8, 8));
|
this.setTurretYRot(this.getTurretYRot() + Mth.clamp(0.95f * diffY, -20, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTurretYRot() {
|
public float getTurretYRot() {
|
||||||
|
@ -490,7 +490,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
|
|
||||||
protected void clampRotation(Entity entity) {
|
protected void clampRotation(Entity entity) {
|
||||||
float f = Mth.wrapDegrees(entity.getXRot());
|
float f = Mth.wrapDegrees(entity.getXRot());
|
||||||
float f1 = Mth.clamp(f, -25.0F, 10F);
|
float f1 = Mth.clamp(f, -32.5F, 15F);
|
||||||
entity.xRotO += f1 - f;
|
entity.xRotO += f1 - f;
|
||||||
entity.setXRot(entity.getXRot() + f1 - f);
|
entity.setXRot(entity.getXRot() + f1 - f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1347,6 +1347,10 @@ public class ClientEventHandler {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.getVehicle() instanceof Lav150Entity) {
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (player.getVehicle() instanceof SpeedboatEntity && zoom) {
|
if (player.getVehicle() instanceof SpeedboatEntity && zoom) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,14 @@ public abstract class CameraMixin {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((player.getVehicle() instanceof Lav150Entity lav150 && lav150.getFirstPassenger() == player) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
||||||
|
setRotation(-Mth.lerp(partialTicks, lav150.turretYRotO - lav150.yRotO, lav150.getTurretYRot() - lav150.getYRot()), Mth.lerp(partialTicks, lav150.turretXRotO - lav150.xRotO, lav150.getTurretXRot() - lav150.getXRot()));
|
||||||
|
setPosition(Mth.lerp(partialTicks, player.xo, player.getX()), Mth.lerp(partialTicks, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTicks, player.zo, player.getZ()));
|
||||||
|
info.cancel();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {
|
||||||
DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
||||||
if (drone != null) {
|
if (drone != null) {
|
||||||
|
|
|
@ -57,9 +57,9 @@ public class MouseHandlerMixin {
|
||||||
|
|
||||||
if (player.getVehicle() instanceof Lav150Entity) {
|
if (player.getVehicle() instanceof Lav150Entity) {
|
||||||
if (ClientEventHandler.zoom) {
|
if (ClientEventHandler.zoom) {
|
||||||
return 0.22;
|
return 0.23;
|
||||||
} else {
|
} else {
|
||||||
return 0.31;
|
return 0.28;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 308 B |
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 91 B |
Binary file not shown.
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 24 KiB |
Loading…
Add table
Reference in a new issue