优化火炮指示器显示效果和操纵
This commit is contained in:
parent
8b8bbc7f0d
commit
44bb4340ba
2 changed files with 14 additions and 8 deletions
|
@ -59,9 +59,9 @@ public class SpyglassRangeOverlay implements LayeredDraw.Layer {
|
|||
var screenWidth = guiGraphics.guiWidth();
|
||||
var screenHeight = guiGraphics.guiHeight();
|
||||
|
||||
if (((player.isUsingItem() && player.getUseItem().is(ModItems.ARTILLERY_INDICATOR.get())) || player.isScoping()) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
||||
if (player.getUseItem().is(ModItems.ARTILLERY_INDICATOR.get())) {
|
||||
ItemStack stack = player.getUseItem();
|
||||
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();
|
||||
poseStack.pushPose();
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.depthMask(false);
|
||||
|
@ -79,14 +79,16 @@ public class SpyglassRangeOverlay implements LayeredDraw.Layer {
|
|||
float k = ((screenWidth - i) / 2);
|
||||
float l = ((screenHeight - j) / 2);
|
||||
float w = i * 21 / 9;
|
||||
preciseBlit(guiGraphics, Mod.loc("textures/screens/spyglass.png"), k - (2 * w / 7), l, 0, 0.0F, w, j, w, j);
|
||||
if (player.isUsingItem()) {
|
||||
preciseBlit(guiGraphics, Mod.loc("textures/screens/spyglass.png"), k - (2 * w / 7), l, 0, 0.0F, w, j, w, j);
|
||||
}
|
||||
|
||||
// 标记位置
|
||||
Vec3 pos;
|
||||
var parameters = stack.get(ModDataComponents.FIRING_PARAMETERS);
|
||||
if (parameters != null) {
|
||||
var blockPos = parameters.pos();
|
||||
pos = new Vec3(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
pos = new Vec3(blockPos.getX() - 0.5, blockPos.getY() + 0.5, blockPos.getZ() + 0.5);
|
||||
} else {
|
||||
pos = Vec3.ZERO;
|
||||
}
|
||||
|
@ -115,12 +117,16 @@ public class SpyglassRangeOverlay implements LayeredDraw.Layer {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
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)),
|
||||
|
|
|
@ -296,7 +296,7 @@ public class ClientEventHandler {
|
|||
PacketDistributor.sendToServer(ArtilleryIndicatorFireMessage.INSTANCE);
|
||||
}
|
||||
} else {
|
||||
holdArtilleryIndicator = Mth.clamp(holdArtilleryIndicator - 1, 0, 10);
|
||||
holdArtilleryIndicator = 0;
|
||||
}
|
||||
|
||||
isProne(player);
|
||||
|
|
Loading…
Add table
Reference in a new issue