diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/SpyglassRangeOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/SpyglassRangeOverlay.java index 2a9d0ee7d..1d18a0bc5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/SpyglassRangeOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/SpyglassRangeOverlay.java @@ -59,9 +59,9 @@ public class SpyglassRangeOverlay implements LayeredDraw.Layer { var screenWidth = guiGraphics.guiWidth(); var screenHeight = guiGraphics.guiHeight(); - if ((player.getMainHandItem().is(ModItems.ARTILLERY_INDICATOR.get()) || player.isScoping()) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) { - if (player.getMainHandItem().is(ModItems.ARTILLERY_INDICATOR.get())) { - ItemStack stack = player.getMainHandItem(); + if (((player.isUsingItem() && player.getUseItem().is(ModItems.ARTILLERY_INDICATOR.get())) || player.isScoping()) && mc.options.getCameraType() == CameraType.FIRST_PERSON) { + if (player.getUseItem().is(ModItems.ARTILLERY_INDICATOR.get())) { + ItemStack stack = player.getUseItem(); poseStack.pushPose(); RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); @@ -79,9 +79,7 @@ public class SpyglassRangeOverlay implements LayeredDraw.Layer { float k = ((screenWidth - i) / 2); float l = ((screenHeight - j) / 2); float w = i * 21 / 9; - if (player.isUsingItem()) { - preciseBlit(guiGraphics, Mod.loc("textures/screens/spyglass.png"), k - (2 * w / 7), l, 0, 0.0F, w, j, w, j); - } + preciseBlit(guiGraphics, Mod.loc("textures/screens/spyglass.png"), k - (2 * w / 7), l, 0, 0.0F, w, j, w, j); // 标记位置 Vec3 pos; @@ -117,16 +115,12 @@ public class SpyglassRangeOverlay implements LayeredDraw.Layer { } } - if (ClientEventHandler.holdArtilleryIndicator > 0) { - RenderHelper.fill(guiGraphics, RenderType.guiOverlay(), (float) screenWidth / 2 - 20, (float) (screenHeight / 2 + 44), (float) screenWidth / 2 + 20, (float) screenHeight / 2 + 48, -90, -16777216); - RenderHelper.fill(guiGraphics, RenderType.guiOverlay(), (float) screenWidth / 2 - 20, (float) (screenHeight / 2 + 44), (float) (screenWidth / 2 - 20 + 4 * ClientEventHandler.holdArtilleryIndicator), (float) screenHeight / 2 + 48, -90, -1); - } + RenderHelper.fill(guiGraphics, RenderType.guiOverlay(), (float) screenWidth / 2 - 20, (float) (screenHeight / 2 + 44), (float) screenWidth / 2 + 20, (float) screenHeight / 2 + 48, -90, -16777216); + RenderHelper.fill(guiGraphics, RenderType.guiOverlay(), (float) screenWidth / 2 - 20, (float) (screenHeight / 2 + 44), (float) (screenWidth / 2 - 20 + 4 * ClientEventHandler.holdArtilleryIndicator), (float) screenHeight / 2 + 48, -90, -1); poseStack.popPose(); } - // vehicle info display - boolean lookAtEntity = false; BlockHitResult result = player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getViewVector(1).scale(512)),