From 3a5ec09058b7289ab10050f287571c186e197f12 Mon Sep 17 00:00:00 2001 From: Light_Quanta Date: Mon, 5 May 2025 20:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1=E7=9A=84@O?= =?UTF-8?q?nlyIn(Dist.CLIENT)=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/vehicle/PrismTankEntity.java | 4 ++++ .../superbwarfare/entity/vehicle/Yx100Entity.java | 4 ++++ .../superbwarfare/entity/vehicle/base/VehicleEntity.java | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java index af5b4776b..78b8d2f0c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/PrismTankEntity.java @@ -49,6 +49,8 @@ import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.*; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.neoforge.capabilities.Capabilities; import net.neoforged.neoforge.event.EventHooks; import net.neoforged.neoforge.network.PacketDistributor; @@ -779,6 +781,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo return Mod.loc("textures/vehicle_icon/prism_tank_icon.png"); } + @OnlyIn(Dist.CLIENT) @Override public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) { float minWH = (float) Math.min(screenWidth, screenHeight); @@ -794,6 +797,7 @@ public class PrismTankEntity extends ContainerMobileVehicleEntity implements Geo guiGraphics.drawString(font, Component.literal("LASER " + (this.getEntityData().get(HEAT) + 25) + " ℃"), screenWidth / 2 - 33, screenHeight - 65, Mth.hsvToRgb((float) heat / 3.745318352059925F, 1.0F, 1.0F), false); } + @OnlyIn(Dist.CLIENT) @Override public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) { super.renderThirdPersonOverlay(guiGraphics, font, player, screenWidth, screenHeight, scale); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index 897a813ff..a47453d32 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -55,6 +55,8 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.neoforge.event.EventHooks; import net.neoforged.neoforge.network.PacketDistributor; import org.jetbrains.annotations.NotNull; @@ -1223,6 +1225,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti return Mod.loc("textures/vehicle_icon/yx_100_icon.png"); } + @OnlyIn(Dist.CLIENT) @Override public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) { float minWH = (float) Math.min(screenWidth, screenHeight); @@ -1259,6 +1262,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti } } + @OnlyIn(Dist.CLIENT) @Override public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) { if (this.getWeaponIndex(0) == 0) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java index a86538693..d015709b4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java @@ -970,6 +970,10 @@ public abstract class VehicleEntity extends Entity { return getEyePosition(); } + /** + * 渲染载具的第一人称UI + * 务必标记 @OnlyIn(Dist.CLIENT) ! + */ @OnlyIn(Dist.CLIENT) public void renderFirstPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) { if (!(this instanceof WeaponVehicleEntity weaponVehicle)) return; @@ -999,6 +1003,10 @@ public abstract class VehicleEntity extends Entity { preciseBlit(guiGraphics, texture, centerW, centerH, 0, 0, scaledMinWH, scaledMinWH, scaledMinWH, scaledMinWH); } + /** + * 渲染载具的第三人称UI + * 务必标记 @OnlyIn(Dist.CLIENT) ! + */ @OnlyIn(Dist.CLIENT) public void renderThirdPersonOverlay(GuiGraphics guiGraphics, Font font, Player player, int screenWidth, int screenHeight, float scale) { }