diff --git a/game/client/src/main/java/net/minecraft/client/Minecraft.java b/game/client/src/main/java/net/minecraft/client/Minecraft.java index 874a85532..f4c5a0f09 100644 --- a/game/client/src/main/java/net/minecraft/client/Minecraft.java +++ b/game/client/src/main/java/net/minecraft/client/Minecraft.java @@ -11,18 +11,7 @@ import net.minecraft.client.entity.ClientSkinVariantList; import net.minecraft.client.entity.player.PlayerLocal; import net.minecraft.client.entity.player.PlayerLocalMultiplayer; import net.minecraft.client.enums.EnumGPUVendor; -import net.minecraft.client.gui.ExceptionPopupElement; -import net.minecraft.client.gui.MainMenuBackground; -import net.minecraft.client.gui.Screen; -import net.minecraft.client.gui.ScreenConnecting; -import net.minecraft.client.gui.ScreenConsole; -import net.minecraft.client.gui.ScreenGameOver; -import net.minecraft.client.gui.ScreenMainMenu; -import net.minecraft.client.gui.ScreenPause; -import net.minecraft.client.gui.ScreenPhotoMode; -import net.minecraft.client.gui.ScreenSleepSP; -import net.minecraft.client.gui.ScreenStats; -import net.minecraft.client.gui.TooltipElement; +import net.minecraft.client.gui.*; import net.minecraft.client.gui.achievements.ScreenAchievements; import net.minecraft.client.gui.chat.ScreenChat; import net.minecraft.client.gui.chat.ScreenSleepMP; @@ -33,6 +22,7 @@ import net.minecraft.client.gui.error.ScreenConflictWarning; import net.minecraft.client.gui.error.ScreenMissingMinecraft; import net.minecraft.client.gui.error.ScreenOutOfMemory; import net.minecraft.client.gui.hud.HudIngame; +import net.minecraft.client.gui.hud.component.HudComponents; import net.minecraft.client.gui.modelviewer.ScreenModelViewer; import net.minecraft.client.gui.options.data.OptionsPages; import net.minecraft.client.gui.popup.PopupScreen; @@ -1420,7 +1410,7 @@ public class Minecraft GameSettings.FLIGHT_SPEED.value = newSpeed; this.thePlayer.setFlySpeed(newSpeed); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.FLIGHT_SPEED); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.FLIGHT_SPEED); } else if (!GameSettings.KEY_ZOOM.isPressed()) { this.thePlayer.inventory.changeCurrentSlot(scrollDelta); } @@ -1517,35 +1507,35 @@ public class Minecraft this.fullbright = !this.fullbright; } } - this.hudIngame.heldItemTooltipElement.setString("Fullbright: " + (this.fullbright ? "On" : "Off")); + HudComponents.DYNAMIC_TOOLTIP.setString("Fullbright: " + (this.fullbright ? "On" : "Off")); } else if (GameSettings.KEY_LIGHTMAPS.isPressEvent()) { if (GameSettings.LIGHTMAP_STYLE.value == LightmapStyle.COLORIZED) { GameSettings.LIGHTMAP_STYLE.value = LightmapStyle.GRAY; - this.hudIngame.heldItemTooltipElement.setString("Lightmap: Gray"); + HudComponents.DYNAMIC_TOOLTIP.setString("Lightmap: Gray"); } else { GameSettings.LIGHTMAP_STYLE.value = LightmapStyle.COLORIZED; - this.hudIngame.heldItemTooltipElement.setString("Lightmap: Colored"); + HudComponents.DYNAMIC_TOOLTIP.setString("Lightmap: Colored"); } } else if (GameSettings.KEY_COLLISION_BOXES.isPressEvent()) { GameSettings.SHOW_COLLISION_BOXES.toggle(); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.SHOW_COLLISION_BOXES); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.SHOW_COLLISION_BOXES); } else if (GameSettings.KEY_CHUNK_BORDERS.isPressEvent()) { GameSettings.SHOW_CHUNK_BORDERS.toggle(); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.SHOW_CHUNK_BORDERS); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.SHOW_CHUNK_BORDERS); } else if (GameSettings.KEY_CLEAR_CHAT.isPressEvent()) { this.hudIngame.clearChatMessages(); } else if (GameSettings.KEY_PAUSE_LOST_FOCUS.isPressEvent()) { GameSettings.PAUSE_ON_LOST_FOCUS.toggle(); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.PAUSE_ON_LOST_FOCUS); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.PAUSE_ON_LOST_FOCUS); } else if (GameSettings.KEY_TOGGLE_ITEM_INFO.isPressEvent()) { GameSettings.SHOW_ITEM_DEBUG_INFO.toggle(); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.SHOW_ITEM_DEBUG_INFO); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.SHOW_ITEM_DEBUG_INFO); } else if (GameSettings.KEY_RELOAD_CHUNKS.isPressEvent()) { this.renderGlobal.allChanged(); } else if (GameSettings.KEY_SMOOTH_LIGHTING.isPressEvent()) { GameSettings.AMBIENT_OCCLUSION.toggle(); GameSettings.AMBIENT_OCCLUSION.onUpdate(); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.AMBIENT_OCCLUSION); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.AMBIENT_OCCLUSION); } if (!GameSettings.KEY_TOGGLE_DEBUG.isPressEvent()) this.f3Press = false; } else if (GameSettings.KEY_RELEASE_CURSOR.isPressEvent()) { @@ -1673,7 +1663,7 @@ public class Minecraft } // Toggle overlay - if (GameSettings.KEY_TOGGLE_OVERLAY.isPressEvent(currentInputDevice)) { + if (GameSettings.KEY_TOGGLE_INFO_OVERLAY.isPressEvent(currentInputDevice)) { if (control) { GameSettings.OVERLAY_MODE.value++; GameSettings.OVERLAY_MODE.value %= 3; @@ -1708,7 +1698,7 @@ public class Minecraft // Cinematic camera if (GameSettings.KEY_CINEMATIC_CAMERA.isPressEvent(currentInputDevice)) { GameSettings.SMOOTH_CAMERA.value = !GameSettings.SMOOTH_CAMERA.value; - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.SMOOTH_CAMERA); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.SMOOTH_CAMERA); return true; } @@ -1824,7 +1814,7 @@ public class Minecraft } GameSettings.RENDER_DISTANCE.set(nextRenderDistance); - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.RENDER_DISTANCE); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.RENDER_DISTANCE); return true; } @@ -1842,7 +1832,7 @@ public class Minecraft } int newGammaStep = ((currentGammaStep + (shift ? -1 : 1)) + 5) % 5; GameSettings.GAMMA.value = newGammaStep * 0.25f; - this.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.GAMMA); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.GAMMA); return true; } diff --git a/game/client/src/main/java/net/minecraft/client/entity/ClientSkinVariantList.java b/game/client/src/main/java/net/minecraft/client/entity/ClientSkinVariantList.java index 7dcd9bc0d..41619bdcd 100644 --- a/game/client/src/main/java/net/minecraft/client/entity/ClientSkinVariantList.java +++ b/game/client/src/main/java/net/minecraft/client/entity/ClientSkinVariantList.java @@ -213,13 +213,7 @@ public class ClientSkinVariantList extends SkinVariantList { return this.variantEntries.length; } - public static class VariantEntry { - public final String textureKey; - public final double weight; - public VariantEntry(final String key, final double weight) { - this.textureKey = key; - this.weight = weight; - } + public record VariantEntry(String textureKey, double weight) { } } } diff --git a/game/client/src/main/java/net/minecraft/client/entity/player/PlayerLocal.java b/game/client/src/main/java/net/minecraft/client/entity/player/PlayerLocal.java index 1a03d81b3..75279c62e 100644 --- a/game/client/src/main/java/net/minecraft/client/entity/player/PlayerLocal.java +++ b/game/client/src/main/java/net/minecraft/client/entity/player/PlayerLocal.java @@ -5,6 +5,8 @@ import com.mojang.logging.LogUtils; import com.mojang.nbt.tags.CompoundTag; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.hud.HudIngame; +import net.minecraft.client.gui.hud.component.HudComponents; import net.minecraft.client.option.GameSettings; import net.minecraft.client.option.enums.ParticlesQuality; import net.minecraft.client.render.particle.ParticlePickupAnimation; @@ -457,7 +459,7 @@ public class PlayerLocal extends Player { @Override public void sendStatusMessage(String message) { - this.mc.hudIngame.heldItemTooltipElement.setString(message); + HudComponents.DYNAMIC_TOOLTIP.setString(message); } @Override diff --git a/game/client/src/main/java/net/minecraft/client/gui/HeldItemTooltipElement.java b/game/client/src/main/java/net/minecraft/client/gui/HeldItemTooltipElement.java index 2f19fb116..81c86c421 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/HeldItemTooltipElement.java +++ b/game/client/src/main/java/net/minecraft/client/gui/HeldItemTooltipElement.java @@ -11,6 +11,8 @@ import net.minecraft.client.util.helper.Colors; import net.minecraft.core.util.helper.Time; import org.jetbrains.annotations.NotNull; +/** @deprecated - replaced with HudComponentDynamicTooltip. All logic now belongs in the HudComponent **/ +@Deprecated public class HeldItemTooltipElement extends Gui { private int lastItemID; @@ -26,28 +28,20 @@ public class HeldItemTooltipElement extends Gui { private final double fadeTime = 0.5; public HeldItemTooltipElement() {} - - public void updateAndRender(Minecraft mc, int width, int height, int screenPadding) { - if(GameSettings.HELD_ITEM_TOOLTIPS.value) { - ItemStack item = mc.thePlayer.getCurrentEquippedItem(); - - int id = getItemID(item); - int i = mc.thePlayer.inventory.getCurrentSlot(); - - if(id != this.lastItemID || i != this.lastSelectedItem) { - updateString(item); - - this.time = this.displayTime; - this.lastItemID = id; - this.lastSelectedItem = i; - } - } - + public void updateAndRender(Minecraft mc, int width, int height, int screenPadding) { + runChecksAndUpdate(mc); render(mc, width, height, screenPadding); } + + public void updateAndRender(Minecraft mc, int x, int y) { - if(GameSettings.HELD_ITEM_TOOLTIPS.value) { + runChecksAndUpdate(mc); + render(mc, x, y); + } + + private void runChecksAndUpdate(Minecraft mc) { + if(GameSettings.HIDE_DYNAMIC_TOOLTIP.value) { ItemStack item = mc.thePlayer.getCurrentEquippedItem(); int id = getItemID(item); @@ -56,16 +50,14 @@ public class HeldItemTooltipElement extends Gui { if(id != this.lastItemID || i != this.lastSelectedItem) { updateString(item); - this.time = this.displayTime; + this.time = this.displayTime; - this.lastItemID = id; - this.lastSelectedItem = i; + this.lastItemID = id; + this.lastSelectedItem = i; } } - - render(mc, x, y); } - + private void updateString(ItemStack item) { if(item == null) { this.string = null; diff --git a/game/client/src/main/java/net/minecraft/client/gui/ScreenHudEditor.java b/game/client/src/main/java/net/minecraft/client/gui/ScreenHudEditor.java index 81f896dd7..b3132923d 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/ScreenHudEditor.java +++ b/game/client/src/main/java/net/minecraft/client/gui/ScreenHudEditor.java @@ -7,129 +7,587 @@ import net.minecraft.client.gui.hud.component.HudComponentMovable; import net.minecraft.client.gui.hud.component.layout.LayoutAbsolute; import net.minecraft.client.gui.hud.component.layout.Layout; import net.minecraft.client.gui.hud.component.layout.LayoutSnap; +import net.minecraft.client.gui.options.ScreenOptions; +import net.minecraft.client.gui.options.components.KeyBindingComponent; +import net.minecraft.client.gui.options.components.OptionsComponent; +import net.minecraft.client.gui.options.data.OptionsPage; +import net.minecraft.client.input.InputDevice; import net.minecraft.client.option.GameSettings; +import net.minecraft.client.option.KeyBinding; import net.minecraft.client.option.Option; -import net.minecraft.client.option.OptionBoolean; import net.minecraft.client.render.renderer.GLRenderer; import net.minecraft.client.render.renderer.Shaders; import net.minecraft.client.render.renderer.State; import net.minecraft.client.render.tessellator.TessellatorGeneral; import net.minecraft.core.lang.I18n; +import net.minecraft.core.net.command.TextFormatting; import net.minecraft.core.sound.SoundCategory; +import net.minecraft.core.util.helper.Color; import net.minecraft.core.util.helper.MathHelper; import org.jetbrains.annotations.NotNull; +import org.lwjgl.input.Keyboard; +import java.awt.*; import java.util.ArrayList; import java.util.List; +import java.util.function.Supplier; -public class ScreenHudEditor - extends Screen { - private static final int BOTTOM_SPACE = 28; +public class ScreenHudEditor extends Screen { private final List componentsUnderMouse = new ArrayList<>(); + + private HudComponent selectedComponent = null; + private boolean isDragging = false; + private int clickMouseX = 0; + private int clickMouseY = 0; + private HudComponent heldComponent = null; private ComponentAnchor heldAnchor = ComponentAnchor.TOP_LEFT; private HudComponent snappedComponent = null; private ComponentAnchor snappedAnchor = null; - private float screenPadding = 0.0f; - private ButtonElement resetButton; + private int nudgeTimer = 0; + + private final List activeContextComponents = new ArrayList<>(); + private OptionsComponent clickedContextComponent = null; + private int clickedContextComponentY = 0; + private int contextMenuX, contextMenuY, contextMenuWidth, contextMenuHeight; + private ScreenOptions contextOptionsScreen; + + private boolean showOnboarding = false; public ScreenHudEditor(Screen parent) { super(parent); } - private final int BUTTON_ELEMENT_DONE = 0; - private final int BUTTON_ELEMENT_RESET = 1; - @Override public void init() { super.init(); - this.screenPadding = GameSettings.SCREEN_PADDING.value; - GameSettings.SCREEN_PADDING.set(0.0f); - add(new ButtonElement(BUTTON_ELEMENT_DONE, this.width / 2 - 100, this.height - BOTTOM_SPACE + (BOTTOM_SPACE - 20) / 2, 178, 20, I18n.getInstance().translateKey("gui.hud_designer.button.done"))); - add(this.resetButton = new ButtonElement(BUTTON_ELEMENT_RESET, this.width / 2 + 80, this.height - BOTTOM_SPACE + (BOTTOM_SPACE - 20) / 2, 20, 20, "") - .setTextures("minecraft:gui/misc/button_reset", "minecraft:gui/misc/button_reset_highlighted", "minecraft:gui/misc/button_reset")); + this.showOnboarding = !GameSettings.SEEN_HUD_EDITOR_ONBOARDING.value; + + OptionsPage contextPage = new OptionsPage("context_menu", null); + this.contextOptionsScreen = new ScreenOptions(this, contextPage); + this.contextOptionsScreen.opened(this.width, this.height); + this.contextOptionsScreen.fontRenderer = this.fontRenderer; + this.contextOptionsScreen.width = this.width; + this.contextOptionsScreen.height = this.height; + } + + @Override + public void tick() { + super.tick(); + for (OptionsComponent optionsComponent : this.activeContextComponents) { + optionsComponent.tick(); + } + + if (this.selectedComponent instanceof HudComponentMovable movable && !this.isDragging) { + int dx = 0; + int dy = 0; + + if (Keyboard.isKeyDown(Keyboard.KEY_UP)) dy = -1; + else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) dy = 1; + else if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) dx = -1; + else if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) dx = 1; + + if (dx != 0 || dy != 0) { + this.nudgeTimer++; + if (this.nudgeTimer > 8) { + nudge(movable, dx, dy); + } + } else { + this.nudgeTimer = 0; + } + } else { + this.nudgeTimer = 0; + } } @Override public void removed() { super.removed(); - GameSettings.SCREEN_PADDING.set(this.screenPadding); + closeContextMenu(); + } + + private void dismissOnboarding() { + this.showOnboarding = false; + GameSettings.SEEN_HUD_EDITOR_ONBOARDING.set(true); + GameSettings.saveOptions(); + this.mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); + } + + private void nudge(HudComponentMovable movable, int dx, int dy) { + // Hold Shift to nudge faster + if (Keyboard.isKeyDown(GameSettings.KEY_HUD_EDITOR_NUDGE_FAST.getKeyCode())) { + dx *= 10; + dy *= 10; + } + + Layout layout = movable.getLayout(); + + if (layout instanceof LayoutAbsolute absoluteLayout) { + absoluteLayout.setXOffset(absoluteLayout.getXOffset() + dx); + absoluteLayout.setYOffset(absoluteLayout.getYOffset() + dy); + } + else if (layout instanceof LayoutSnap snapLayout) { + snapLayout.setXOffset(snapLayout.getXOffset() + dx); + snapLayout.setYOffset(snapLayout.getYOffset() + dy); + } } @Override - protected void buttonClicked(@NotNull ButtonElement button) { - super.buttonClicked(button); - if (button.id == BUTTON_ELEMENT_DONE) { + public void keyPressed(char eventCharacter, int eventKey, int mx, int my) { + if (this.showOnboarding) { + if (eventKey == Keyboard.KEY_RETURN || eventKey == Keyboard.KEY_SPACE || eventKey == Keyboard.KEY_ESCAPE) { + dismissOnboarding(); + } + return; + } + + if (ScreenOptions.pickingKeyBinding != null) { + if (eventKey == Keyboard.KEY_ESCAPE) { + ScreenOptions.pickingKeyBinding.unbind(); + } else { + ScreenOptions.pickingKeyBinding.bind(InputDevice.keyboard, eventKey); + } + + if (ScreenOptions.pickingKeyBindingComponent != null) { + ScreenOptions.pickingKeyBindingComponent.update(); + } + + ScreenOptions.pickingKeyBinding = null; + ScreenOptions.pickingKeyBindingComponent = null; + return; + } + + // Funnel key presses to the context menu if it is open + if (!this.activeContextComponents.isEmpty()) { + if (eventKey == Keyboard.KEY_ESCAPE) { + closeContextMenu(); + return; + } + for (OptionsComponent comp : this.activeContextComponents) { + comp.onKeyPress(eventKey, eventCharacter); + } + return; + } + + if (eventKey == GameSettings.KEY_HUD_EDITOR_EXIT.getKeyCode()) { this.mc.displayScreen(getParentScreen()); + this.mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); + return; + } + + if (eventKey == GameSettings.KEY_HUD_EDITOR_ONBOARDING.getKeyCode()) { + this.showOnboarding = true; + this.mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); + return; } - if (button.id == BUTTON_ELEMENT_RESET) { + + if (eventKey == GameSettings.KEY_HUD_EDITOR_RESET.getKeyCode()) { HudComponents.INSTANCE.fromSettingsString(HudComponents.DEFAULT_LAYOUT); for (HudComponent component : HudComponents.INSTANCE.getComponents()) { - if (component.getAttachedOption() != null) { - component.getAttachedOption().resetValueToDefault(); + for (Option option : component.getRawOptions()) { + option.resetValueToDefault(); } } + this.mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); + return; + } + + // Nudge + if (this.selectedComponent instanceof HudComponentMovable movable && !this.isDragging) { + int dx = 0; + int dy = 0; + + if (eventKey == GameSettings.KEY_HUD_EDITOR_NUDGE_UP.getKeyCode()) dy = -1; + else if (eventKey == GameSettings.KEY_HUD_EDITOR_NUDGE_DOWN.getKeyCode()) dy = 1; + else if (eventKey == GameSettings.KEY_HUD_EDITOR_NUDGE_LEFT.getKeyCode()) dx = -1; + else if (eventKey == GameSettings.KEY_HUD_EDITOR_NUDGE_RIGHT.getKeyCode()) dx = 1; + + if (dx != 0 || dy != 0) { + nudge(movable, dx, dy); + this.nudgeTimer = 0; + return; + } } + super.keyPressed(eventCharacter, eventKey, mx, my); } @Override public void mouseClicked(int mx, int my, int buttonNum) { + if (this.showOnboarding) { + dismissOnboarding(); + return; + } + + if (ScreenOptions.pickingKeyBinding != null) { + ScreenOptions.pickingKeyBinding.bind(InputDevice.mouse, buttonNum); + if (ScreenOptions.pickingKeyBindingComponent != null) { + ScreenOptions.pickingKeyBindingComponent.update(); + ScreenOptions.pickingKeyBindingComponent = null; + } + return; + } + + // Context Menu Interaction + if (!this.activeContextComponents.isEmpty()) { + if (mx >= this.contextMenuX && mx <= this.contextMenuX + this.contextMenuWidth && + my >= this.contextMenuY && my <= this.contextMenuY + this.contextMenuHeight) { + + int currentY = this.contextMenuY + 4; + int left = this.contextMenuX + 4; + int width = this.contextMenuWidth - 8; + + for (OptionsComponent comp : this.activeContextComponents) { + if (my >= currentY && my <= currentY + comp.getHeight()) { + comp.onMouseClick(buttonNum, left, currentY, width, mx - left, my - currentY); + this.clickedContextComponent = comp; + this.clickedContextComponentY = currentY; + break; + } + currentY += comp.getHeight(); + } + return; + } else { + closeContextMenu(); + } + } + updateComponentsUnderMouse(mx, my); boolean clickedComponent = false; - if (buttonNum == 0) { + + // Selection and Dragging + if (buttonNum == GameSettings.KEY_HUD_EDITOR_SELECT.getKeyCode()) { if (!this.componentsUnderMouse.isEmpty()) { HudComponent componentUnderMouse = this.componentsUnderMouse.get(this.componentsUnderMouse.size() - 1); + this.selectedComponent = componentUnderMouse; + if (componentUnderMouse instanceof HudComponentMovable) { + this.heldComponent = componentUnderMouse; + this.clickMouseX = mx; + this.clickMouseY = my; + this.isDragging = false; + Layout currentLayout = componentUnderMouse.getLayout(); - ComponentAnchor anchor = getClosestAnchor( - currentLayout.getComponentX(componentUnderMouse, this.width), - currentLayout.getComponentY(componentUnderMouse, this.height - BOTTOM_SPACE), - componentUnderMouse, mx, my); - Layout layout = new LayoutAbsolute(0, 0, anchor); - ((HudComponentMovable) componentUnderMouse).setLayout(layout); + this.heldAnchor = getClosestAnchor( + currentLayout.getComponentX(componentUnderMouse, this.width), + currentLayout.getComponentY(componentUnderMouse, this.height), + componentUnderMouse, mx, my); - this.heldComponent = componentUnderMouse; - this.heldAnchor = anchor; clickedComponent = true; + + this.mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); } } } - if (buttonNum == 1) { + + // Open Context Menu + if (buttonNum == GameSettings.KEY_HUD_EDITOR_OPEN_CONTEXT.getKeyCode()) { if (!this.componentsUnderMouse.isEmpty()) { HudComponent componentUnderMouse = this.componentsUnderMouse.get(this.componentsUnderMouse.size() - 1); - Option attachedOption = componentUnderMouse.getAttachedOption(); - if (attachedOption instanceof OptionBoolean optionBoolean) { - mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); - optionBoolean.toggle(); - } + this.selectedComponent = componentUnderMouse; + + List> optionSuppliers = componentUnderMouse.getOptionSuppliers(); + List> keyBindingSuppliers = componentUnderMouse.getKeyBindingSuppliers(); + boolean hasOptions = optionSuppliers != null && !optionSuppliers.isEmpty(); + boolean hasKeyBindings = keyBindingSuppliers != null && !keyBindingSuppliers.isEmpty(); + + if (hasOptions || hasKeyBindings) { + openContextMenu(componentUnderMouse, mx, my); + clickedComponent = true; + + this.mc.sndManager.playSound("random.click", SoundCategory.GUI_SOUNDS, 1.0F, 1.0F); + } } } - if (!clickedComponent) { + if (!clickedComponent && buttonNum == 0) { + this.selectedComponent = null; this.heldComponent = null; super.mouseClicked(mx, my, buttonNum); } } + private void openContextMenu(HudComponent component, int mx, int my) { + this.activeContextComponents.clear(); + + // Add Option Components + if (component.getOptionSuppliers() != null) { + for (Supplier supplier : component.getOptionSuppliers()) { + OptionsComponent comp = supplier.get(); + comp.init(this.mc); + this.activeContextComponents.add(comp); + } + } + + // Add KeyBinding Components (Appended to the end) + if (component.getKeyBindingSuppliers() != null) { + for (Supplier supplier : component.getKeyBindingSuppliers()) { + KeyBindingComponent comp = supplier.get(); + comp.init(this.mc); + this.activeContextComponents.add(comp); + } + } + + // Dynamic Width Parameters + int maxTextWidth = 0; + int sidePadding = 16; + int textControlSpacing = 20; + int controlWidth = 150; + + boolean hasContent = false; + + if (component.getRawOptions() != null) { + for (Option option : component.getRawOptions()) { + hasContent = true; + String optionName = I18n.getInstance().translateKey(option.getDisplayStringName()); + int textWidth = this.fontRenderer.stringWidth(optionName); + if (textWidth > maxTextWidth) { + maxTextWidth = textWidth; + } + } + } + + if (component.getRawKeyBindings() != null) { + for (KeyBinding keyBinding : component.getRawKeyBindings()) { + hasContent = true; + controlWidth += 50; + String keyName = I18n.getInstance().translateKey(keyBinding.getKeyName()); + int textWidth = this.fontRenderer.stringWidth(keyName); + if (textWidth > maxTextWidth) { + maxTextWidth = textWidth; + } + } + } + + if (hasContent) { + this.contextMenuWidth = sidePadding + maxTextWidth + textControlSpacing + controlWidth; + } else { + this.contextMenuWidth = 200; + } + + // Height Calculation + int totalHeight = 0; + for (OptionsComponent comp : this.activeContextComponents) { + totalHeight += comp.getHeight(); + } + this.contextMenuHeight = totalHeight + 8; + + // Positional Logic for placement of the context box + boolean isRightHalf = mx > (this.width / 2); + boolean isBottomHalf = my > (this.height / 2); + + if (isRightHalf) { + this.contextMenuX = mx - this.contextMenuWidth; // Place Left + } else { + this.contextMenuX = mx; // Place Right + } + + if (isBottomHalf) { + this.contextMenuY = my - this.contextMenuHeight; // Place Up + } else { + this.contextMenuY = my; // Place Down + } + + // Screen Bounds Clamping + if (this.contextMenuX < 0) this.contextMenuX = 0; + if (this.contextMenuX + this.contextMenuWidth > this.width) this.contextMenuX = this.width - this.contextMenuWidth; + if (this.contextMenuY < 0) this.contextMenuY = 0; + if (this.contextMenuY + this.contextMenuHeight > this.height) this.contextMenuY = this.height - this.contextMenuHeight; + } + + private void closeContextMenu() { + for (OptionsComponent comp : this.activeContextComponents) { + comp.onClose(); + } + this.activeContextComponents.clear(); + this.clickedContextComponent = null; + } + + @Override + public void mouseReleased(int mx, int my, int buttonNum) { + if (this.clickedContextComponent != null) { + int left = this.contextMenuX + 4; + int width = this.contextMenuWidth - 8; + if (buttonNum >= 0) { + this.clickedContextComponent.onMouseRelease(buttonNum, left, this.clickedContextComponentY, width, mx - left, my - this.clickedContextComponentY); + this.clickedContextComponent = null; + } else { + this.clickedContextComponent.onMouseMove(left, this.clickedContextComponentY, width, mx - left, my - this.clickedContextComponentY); + } + return; + } + + if (buttonNum == 0) { + this.heldComponent = null; + this.heldAnchor = null; + this.snappedComponent = null; + this.snappedAnchor = null; + this.isDragging = false; + } + super.mouseReleased(mx, my, buttonNum); + } + + @Override + public void render(int mx, int my, float partialTick) { + if (!this.activeContextComponents.isEmpty() && this.clickedContextComponent != null) { + this.clickedContextComponent.onMouseMove(this.contextMenuX + 4, this.clickedContextComponentY, this.contextMenuWidth - 8, mx - (this.contextMenuX + 4), my - this.clickedContextComponentY); + } + + updateComponentsUnderMouse(mx, my); + + if (this.heldComponent != null) { + updateHeldComponent(mx, my); + } + + renderTexturedBackground(); + drawHudComponents(mx, my); + + if (this.heldComponent != null && this.isDragging) { + for (ComponentAnchor anchor : ComponentAnchor.values()) { + if (anchor == ComponentAnchor.CENTER) continue; + drawAnchor(0, 0, (int) (this.width * anchor.xPosition), (int) (this.height * anchor.yPosition), anchor); + } + } + + super.render(mx, my, partialTick); + + if (!this.activeContextComponents.isEmpty()) { + drawContextMenu(mx, my); + } + + if (ScreenOptions.pickingKeyBinding != null) { + GLRenderer.pushFrame(); + GLRenderer.disableState(State.DEPTH_TEST); + + drawRect(0, 0, this.width, this.height, 0x80000000); + + String actionName = I18n.getInstance().translateKey(ScreenOptions.pickingKeyBinding.getId()); + String prompt = "Press a key or mouse binding to set it as the keybinding for '" + actionName + "'."; + + drawStringCenteredShadow(this.fontRenderer, prompt, this.width / 2, this.height / 2, 0xFFFFFF); + + GLRenderer.enableState(State.DEPTH_TEST); + GLRenderer.popFrame(); + } + + if (this.showOnboarding) { + drawOnboardingOverlay(); + } + } + + + private void drawOnboardingOverlay() { + GLRenderer.pushFrame(); + GLRenderer.disableState(State.DEPTH_TEST); + + drawRect(0, 0, this.width, this.height, 0xCC000000); + + int boxWidth = 440; + int boxHeight = 230; + int boxX = (this.width - boxWidth) / 2; + int boxY = (this.height - boxHeight) / 2; + + drawRect(boxX, boxY, boxX + boxWidth, boxY + boxHeight, 0xFF222222); + drawRect(boxX + 2, boxY + 2, boxX + boxWidth - 2, boxY + boxHeight - 2, 0xFF333333); + + int centerX = this.width / 2; + + TextFormatting gold = TextFormatting.ORANGE; + TextFormatting white = TextFormatting.WHITE; + TextFormatting yellow = TextFormatting.YELLOW; + TextFormatting gray = TextFormatting.GRAY; + + I18n i18n = I18n.getInstance(); + + drawStringCenteredShadow(this.fontRenderer, gold + i18n.translateKey("gui.options.hudeditor.onboarding.welcome"), centerX, boxY + 15, 0xFFFFFF); + + int startY = boxY + 45; + int lineSpacing = 16; + + String select = GameSettings.KEY_HUD_EDITOR_SELECT.getKeyName(); + String context = GameSettings.KEY_HUD_EDITOR_OPEN_CONTEXT.getKeyName(); + String nudgeUp = GameSettings.KEY_HUD_EDITOR_NUDGE_UP.getKeyName(); + String nudgeDown = GameSettings.KEY_HUD_EDITOR_NUDGE_DOWN.getKeyName(); + String nudgeLeft = GameSettings.KEY_HUD_EDITOR_NUDGE_LEFT.getKeyName(); + String nudgeRight = GameSettings.KEY_HUD_EDITOR_NUDGE_RIGHT.getKeyName(); + String fast = GameSettings.KEY_HUD_EDITOR_NUDGE_FAST.getKeyName(); + String reset = GameSettings.KEY_HUD_EDITOR_RESET.getKeyName(); + String onboarding = GameSettings.KEY_HUD_EDITOR_ONBOARDING.getKeyName(); + String exit = GameSettings.KEY_HUD_EDITOR_EXIT.getKeyName(); + + String arrowKeys = nudgeUp + "/" + nudgeDown + "/" + nudgeLeft + "/" + nudgeRight; + + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.select"), yellow + select + white), centerX, startY, 0xFFFFFF); + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.drag"), yellow + select + white), centerX, startY + lineSpacing, 0xFFFFFF); + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.context"), yellow + context + white), centerX, startY + (lineSpacing * 2), 0xFFFFFF); + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.nudge"), yellow + arrowKeys + white), centerX, startY + (lineSpacing * 3), 0xFFFFFF); + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.nudge_fast"), yellow + fast + white), centerX, startY + (lineSpacing * 4), 0xFFFFFF); + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.reset"), yellow + reset + white), centerX, startY + (lineSpacing * 5), 0xFFFFFF); + drawStringCenteredShadow(this.fontRenderer, white + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.exit"), yellow + exit + white), centerX, startY + (lineSpacing * 6), 0xFFFFFF); + + drawStringCenteredShadow(this.fontRenderer, gray + String.format(i18n.translateKey("gui.options.hudeditor.onboarding.reopen"), yellow + onboarding + gray), centerX, startY + (lineSpacing * 8), 0xFFFFFF); + + int alpha = (int) (Math.abs(Math.sin(System.currentTimeMillis() % 2000 / 2000.0 * Math.PI)) * 245) + 10; + int promptColor = (alpha << 24) | 0xAAAAAA; + + drawStringCenteredShadow(this.fontRenderer, i18n.translateKey("gui.options.hudeditor.onboarding.begin"), centerX, boxY + boxHeight - 20, promptColor); + + GLRenderer.enableState(State.DEPTH_TEST); + GLRenderer.popFrame(); + } + + private void drawContextMenu(int mouseX, int mouseY) { + int minX = this.contextMenuX; + int maxX = this.contextMenuX + this.contextMenuWidth; + int minY = this.contextMenuY; + int maxY = this.contextMenuY + this.contextMenuHeight; + + GLRenderer.pushFrame(); + GLRenderer.disableState(State.DEPTH_TEST); + + drawRect(minX, minY, maxX, maxY, 0xFF222222); + drawRect(minX + 2, minY + 2, maxX - 2, maxY - 2, 0xFF333333); + + int currentY = this.contextMenuY + 4; + int left = this.contextMenuX + 4; + int width = this.contextMenuWidth - 8; + + for (OptionsComponent optionsComponent : this.activeContextComponents) { + optionsComponent.render(this.contextOptionsScreen, left, currentY, width, mouseX - left, mouseY - currentY); + currentY += optionsComponent.getHeight(); + } + + GLRenderer.popFrame(); + } + private void updateHeldComponent(int mouseX, int mouseY) { if (this.heldComponent == null) return; - int xSize = this.heldComponent.getXSize(); - int ySize = this.heldComponent.getYSize(); - int xOffset = this.heldComponent.getAnchorX(this.heldAnchor); - int yOffset = this.heldComponent.getAnchorY(this.heldAnchor); + if (!this.isDragging) { + if (Math.abs(mouseX - this.clickMouseX) > 3 || Math.abs(mouseY - this.clickMouseY) > 3) { + this.isDragging = true; + closeContextMenu(); // Cancel menu if dragging starts + Layout layout = new LayoutAbsolute(0, 0, this.heldAnchor); + ((HudComponentMovable) this.heldComponent).setLayout(layout); + } else { + return; + } + } + + int xSize = this.heldComponent.getDisplayedXSize(); + int ySize = this.heldComponent.getDisplayedYSize(); + int xOffset = this.heldComponent.getDisplayedAnchorX(this.heldAnchor); + int yOffset = this.heldComponent.getDisplayedAnchorY(this.heldAnchor); int newX = MathHelper.clamp(mouseX, xOffset, this.width - (xSize - xOffset)); - int newY = MathHelper.clamp(mouseY, yOffset, this.height - BOTTOM_SPACE - (ySize - yOffset)); + int newY = MathHelper.clamp(mouseY, yOffset, this.height - (ySize - yOffset)); Layout layout = this.heldComponent.getLayout(); if (layout instanceof LayoutAbsolute absoluteLayout) { absoluteLayout.setXPosition((float) newX / this.width); - absoluteLayout.setYPosition((float) newY / (this.height - BOTTOM_SPACE)); + absoluteLayout.setYPosition((float) newY / this.height); } - // Snap to other components int snapRadius = 10; boolean didSnap = false; for (HudComponent component : HudComponents.INSTANCE.getComponents()) { @@ -155,26 +613,20 @@ public class ScreenHudEditor if (isNested) continue; int x = otherLayout.getComponentX(component, this.width); - int y = otherLayout.getComponentY(component, this.height - BOTTOM_SPACE); - - // Get mouse distance - int mouseDistance = (int) Math.sqrt(Math.pow(mouseX - newX, 2) + Math.pow(mouseY - newY, 2)); - - if (mouseDistance < 10) { - ComponentAnchor anchor = getAnchorInRadius(x, y, component, newX, newY, snapRadius); - if (anchor != null && this.heldAnchor.canConnectTo(anchor)) { - this.snappedComponent = component; - this.snappedAnchor = anchor; - LayoutSnap newLayout = new LayoutSnap(component, anchor, this.heldAnchor); - ((HudComponentMovable) this.heldComponent).setLayout(newLayout); - didSnap = true; - break; - } + int y = otherLayout.getComponentY(component, this.height); + + ComponentAnchor anchor = getAnchorInRadius(x, y, component, newX, newY, snapRadius); + if (anchor != null && this.heldAnchor.canConnectTo(anchor)) { + this.snappedComponent = component; + this.snappedAnchor = anchor; + LayoutSnap newLayout = new LayoutSnap(component, anchor, this.heldAnchor); + ((HudComponentMovable) this.heldComponent).setLayout(newLayout); + didSnap = true; + break; } } if (!didSnap) { - // Try screen-edge snapping snapRadius = 20; ComponentAnchor anchor = getScreenAnchorInRadius(0, 0, newX, newY, snapRadius); if (anchor != null) { @@ -186,7 +638,7 @@ public class ScreenHudEditor } if (!didSnap) { - LayoutAbsolute newLayout = new LayoutAbsolute((float) newX / this.width, (float) newY / (this.height - BOTTOM_SPACE), this.heldAnchor); + LayoutAbsolute newLayout = new LayoutAbsolute((float) newX / this.width, (float) newY / this.height, this.heldAnchor); ((HudComponentMovable) this.heldComponent).setLayout(newLayout); this.snappedComponent = null; this.snappedAnchor = null; @@ -195,13 +647,12 @@ public class ScreenHudEditor } private ComponentAnchor getClosestAnchor(int x, int y, HudComponent component, int mouseX, int mouseY) { - // Get closest anchor to mouse ComponentAnchor anchor = ComponentAnchor.TOP_LEFT; int minDistance = Integer.MAX_VALUE; for (ComponentAnchor componentAnchor : ComponentAnchor.values()) { - if (componentAnchor == ComponentAnchor.CENTER) continue; // Center anchor is not valid - int xAnchor = component.getAnchorX(componentAnchor); - int yAnchor = component.getAnchorY(componentAnchor); + if (componentAnchor == ComponentAnchor.CENTER) continue; + int xAnchor = component.getDisplayedAnchorX(componentAnchor); + int yAnchor = component.getDisplayedAnchorY(componentAnchor); int distance = (int) Math.sqrt(Math.pow(mouseX - (x + xAnchor), 2) + Math.pow(mouseY - (y + yAnchor), 2)); if (distance < minDistance) { minDistance = distance; @@ -212,13 +663,12 @@ public class ScreenHudEditor } private ComponentAnchor getAnchorInRadius(int x, int y, HudComponent component, int mouseX, int mouseY, int radius) { - // Get closest anchor to mouse ComponentAnchor anchor = null; int minDistance = Integer.MAX_VALUE; for (ComponentAnchor componentAnchor : ComponentAnchor.values()) { - if (componentAnchor == ComponentAnchor.CENTER) continue; // Center anchor is not valid - int xAnchor = component.getAnchorX(componentAnchor); - int yAnchor = component.getAnchorY(componentAnchor); + if (componentAnchor == ComponentAnchor.CENTER) continue; + int xAnchor = component.getDisplayedAnchorX(componentAnchor); + int yAnchor = component.getDisplayedAnchorY(componentAnchor); int distance = (int) Math.sqrt(Math.pow(mouseX - (x + xAnchor), 2) + Math.pow(mouseY - (y + yAnchor), 2)); if (distance < minDistance && distance <= radius) { minDistance = distance; @@ -229,13 +679,12 @@ public class ScreenHudEditor } private ComponentAnchor getScreenAnchorInRadius(int x, int y, int mouseX, int mouseY, int radius) { - // Get closest anchor to mouse ComponentAnchor anchor = null; int minDistance = Integer.MAX_VALUE; for (ComponentAnchor componentAnchor : ComponentAnchor.values()) { - if (componentAnchor == ComponentAnchor.CENTER) continue; // Center anchor is not valid + if (componentAnchor == ComponentAnchor.CENTER) continue; int xAnchor = (int) (componentAnchor.xPosition * this.width); - int yAnchor = (int) (componentAnchor.yPosition * (this.height - BOTTOM_SPACE)); + int yAnchor = (int) (componentAnchor.yPosition * this.height); int distance = (int) Math.sqrt(Math.pow(mouseX - (x + xAnchor), 2) + Math.pow(mouseY - (y + yAnchor), 2)); if (distance < minDistance && distance <= radius) { minDistance = distance; @@ -245,53 +694,6 @@ public class ScreenHudEditor return anchor; } - @Override - public void mouseReleased(int mx, int my, int buttonNum) { - if (buttonNum == 0) { - this.heldComponent = null; - this.heldAnchor = null; - this.snappedComponent = null; - this.snappedAnchor = null; - } - super.mouseReleased(mx, my, buttonNum); - } - - @Override - public void render(int mx, int my, float partialTick) { - updateComponentsUnderMouse(mx, my); - - if (this.heldComponent != null) { - updateHeldComponent(mx, my); - } - - renderTexturedBackground(); - - drawHudComponents(mx, my); - - TessellatorGeneral tessellator = GLRenderer.getTessellator(); - GLRenderer.pushFrame(); - GLRenderer.setShader(Shaders.COLOR); - GLRenderer.disableState(State.DEPTH_TEST); - tessellator.startDrawingQuads(); - tessellator.setColor2i(0, 255); - tessellator.addVertexWithUV(0, this.height - BOTTOM_SPACE + 1, 0.0D, 0.0D, 1.0D); - tessellator.addVertexWithUV(this.width, this.height - BOTTOM_SPACE + 1, 0.0D, 1.0D, 1.0D); - tessellator.addVertexWithUV(this.width, this.height - BOTTOM_SPACE, 0.0D, 1.0D, 0.0D); - tessellator.addVertexWithUV(0, this.height - BOTTOM_SPACE, 0.0D, 0.0D, 0.0D); - tessellator.draw(); - GLRenderer.popFrame(); - - // Draw all anchors for screen edges - if (this.heldComponent != null) { - for (ComponentAnchor anchor : ComponentAnchor.values()) { - if (anchor == ComponentAnchor.CENTER) continue; // Center anchor is not valid - drawAnchor(0, 0, (int) (this.width * anchor.xPosition), (int) ((this.height - BOTTOM_SPACE) * anchor.yPosition), anchor); - } - } - - super.render(mx, my, partialTick); - } - @Override public void renderTexturedBackground() { super.renderTexturedBackground(); @@ -301,8 +703,8 @@ public class ScreenHudEditor GLRenderer.setColor4f(1.0F, 1.0F, 1.0F, 1.0F); float scale = 32F; tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(0.0D, this.height - BOTTOM_SPACE, 0.0D, 0.0D, (float) (this.height - BOTTOM_SPACE) / scale); - tessellator.addVertexWithUV(this.width, this.height - BOTTOM_SPACE, 0.0D, (float) this.width / scale, (float) (this.height - BOTTOM_SPACE) / scale); + tessellator.addVertexWithUV(0.0D, this.height, 0.0D, 0.0D, (float) this.height / scale); + tessellator.addVertexWithUV(this.width, this.height, 0.0D, (float) this.width / scale, (float) this.height / scale); tessellator.addVertexWithUV(this.width, 0.0D, 0.0D, (float) this.width / scale, 0); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0); tessellator.draw(); @@ -314,47 +716,63 @@ public class ScreenHudEditor lastComponent = this.componentsUnderMouse.get(this.componentsUnderMouse.size() - 1); } for (HudComponent component : HudComponents.INSTANCE.getComponents()) { - if (component == this.heldComponent) continue; + if (component == this.heldComponent && this.isDragging) continue; if (!component.isEnabled()) continue; Layout layout = component.getLayout(); GLRenderer.pushFrame(); - component.renderPreview(this, layout, this.width, this.height - BOTTOM_SPACE); + component.renderPreview(this, layout, this.width, this.height); GLRenderer.popFrame(); - if (this.heldComponent == null) { - if (!this.componentsUnderMouse.isEmpty() && component == lastComponent) { - int x = layout.getComponentX(component, this.width); - int y = layout.getComponentY(component, this.height - BOTTOM_SPACE); - int xSize = component.getXSize(); - int ySize = component.getYSize(); - drawBox(x, y, x + xSize, y + ySize, 0xff00ff00, 1); - ComponentAnchor anchor = getClosestAnchor(x, y, component, mouseX, mouseY); - int xAnchor = component.getAnchorX(anchor); - int yAnchor = component.getAnchorY(anchor); - - drawAnchor(x, y, xAnchor, yAnchor, anchor); + + if (component == this.selectedComponent && (!this.isDragging || component != this.heldComponent)) { + int x = layout.getComponentX(component, this.width); + int y = layout.getComponentY(component, this.height); + int xSize = component.getDisplayedXSize(); + int ySize = component.getDisplayedYSize(); + + drawBox(x, y, x + xSize, y + ySize, 0xffff0000, 1); + + if (mouseX >= x && mouseX < x + xSize && mouseY >= y && mouseY < y + ySize) { + ComponentAnchor closestAnchor = getClosestAnchor(x, y, component, mouseX, mouseY); + int xAnchor = component.getDisplayedAnchorX(closestAnchor); + int yAnchor = component.getDisplayedAnchorY(closestAnchor); + drawAnchor(x, y, xAnchor, yAnchor, closestAnchor); } + + } else if (component == lastComponent && component != this.selectedComponent) { + int x = layout.getComponentX(component, this.width); + int y = layout.getComponentY(component, this.height); + int xSize = component.getDisplayedXSize(); + int ySize = component.getDisplayedYSize(); + + drawBox(x, y, x + xSize, y + ySize, 0xff00ff00, 1); + + ComponentAnchor anchor = getClosestAnchor(x, y, component, mouseX, mouseY); + int xAnchor = component.getDisplayedAnchorX(anchor); + int yAnchor = component.getDisplayedAnchorY(anchor); + drawAnchor(x, y, xAnchor, yAnchor, anchor); } } - if (this.heldComponent != null) { + + if (this.heldComponent != null && this.isDragging) { Layout layout = this.heldComponent.getLayout(); GLRenderer.pushFrame(); - this.heldComponent.renderPreview(this, layout, this.width, this.height - BOTTOM_SPACE); + this.heldComponent.renderPreview(this, layout, this.width, this.height); GLRenderer.popFrame(); int x = layout.getComponentX(this.heldComponent, this.width); - int y = layout.getComponentY(this.heldComponent, this.height - BOTTOM_SPACE); - int xSize = this.heldComponent.getXSize(); - int ySize = this.heldComponent.getYSize(); - int xAnchor = this.heldComponent.getAnchorX(this.heldAnchor); - int yAnchor = this.heldComponent.getAnchorY(this.heldAnchor); + int y = layout.getComponentY(this.heldComponent, this.height); + int xSize = this.heldComponent.getDisplayedXSize(); + int ySize = this.heldComponent.getDisplayedYSize(); + int xAnchor = this.heldComponent.getDisplayedAnchorX(this.heldAnchor); + int yAnchor = this.heldComponent.getDisplayedAnchorY(this.heldAnchor); drawBox(x, y, x + xSize, y + ySize, 0xffff0000, 1); drawAnchor(x, y, xAnchor, yAnchor, this.heldAnchor); } if (this.snappedComponent != null && this.snappedAnchor != null) { Layout layout = this.snappedComponent.getLayout(); int x = layout.getComponentX(this.snappedComponent, this.width); - int y = layout.getComponentY(this.snappedComponent, this.height - BOTTOM_SPACE); - int xAnchor = this.snappedComponent.getAnchorX(this.snappedAnchor); - int yAnchor = this.snappedComponent.getAnchorY(this.snappedAnchor); + int y = layout.getComponentY(this.snappedComponent, this.height); + int xAnchor = this.snappedComponent.getDisplayedAnchorX(this.snappedAnchor); + int yAnchor = this.snappedComponent.getDisplayedAnchorY(this.snappedAnchor); drawAnchor(x, y, xAnchor, yAnchor, this.snappedAnchor); } } @@ -409,12 +827,12 @@ public class ScreenHudEditor if (!component.isEnabled()) continue; Layout layout = component.getLayout(); int cx = layout.getComponentX(component, this.width); - int cy = layout.getComponentY(component, this.height - BOTTOM_SPACE); - int cXSize = component.getXSize(); - int cYSize = component.getYSize(); + int cy = layout.getComponentY(component, this.height); + int cXSize = component.getDisplayedXSize(); + int cYSize = component.getDisplayedYSize(); if (mouseX >= cx && mouseX < cx + cXSize && mouseY >= cy && mouseY < cy + cYSize) { this.componentsUnderMouse.add(component); } } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/container/ScreenInventory.java b/game/client/src/main/java/net/minecraft/client/gui/container/ScreenInventory.java index 6f7db9151..f2dc21dbc 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/container/ScreenInventory.java +++ b/game/client/src/main/java/net/minecraft/client/gui/container/ScreenInventory.java @@ -108,21 +108,21 @@ public class ScreenInventory extends ScreenContainerAbstract { this.overlayButtonsLayout.elements.clear(); if (compass) { - this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.OVERLAY_SHOW_COORDS)); + this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.COORDS_IN_OVERLAY)); this.uvs.add(0); - this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.OVERLAY_SHOW_DIRECTION)); + this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.DIRECTION_IN_OVERLAY)); this.uvs.add(1); } if (clock) { - this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.OVERLAY_SHOW_TIME)); + this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.TIME_IN_OVERLAY)); this.uvs.add(2); } if (rotaryCalendar) { - this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.OVERLAY_SHOW_SEASON)); + this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.SEASON_IN_OVERLAY)); this.uvs.add(3); - this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.OVERLAY_SHOW_WEATHER)); + this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.WEATHER_IN_OVERLAY)); this.uvs.add(4); - this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.OVERLAY_SHOW_BIOME)); + this.overlayButtonsLayout.addElement(new OverlayButtonElement<>(GameSettings.BIOME_IN_OVERLAY)); this.uvs.add(5); } diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/HudIngame.java b/game/client/src/main/java/net/minecraft/client/gui/hud/HudIngame.java index 72ed040fc..e315fd2c7 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/HudIngame.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/HudIngame.java @@ -9,7 +9,6 @@ import com.mojang.logging.LogUtils; import net.minecraft.client.entity.player.PlayerLocalMultiplayer; import net.minecraft.client.gui.chat.ScreenChat; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.HeldItemTooltipElement; import net.minecraft.client.gui.ScreenPhotoMode; import net.minecraft.client.option.GameSettings; import net.minecraft.client.render.OpenGLHelper; @@ -77,12 +76,10 @@ public class HudIngame extends Gui { protected FontRenderer fontRenderer; public int chatScroll = 0; - public final HeldItemTooltipElement heldItemTooltipElement; public HudIngame(Minecraft minecraft) { this.mc = minecraft; this.fontRenderer = this.mc.font; - this.heldItemTooltipElement = new HeldItemTooltipElement(); } public void renderGameOverlay(float partialTicks, boolean flag, int mouseX, int mouseY) { @@ -91,7 +88,6 @@ public class HudIngame extends Gui { I18n stringtranslate = I18n.getInstance(); int width = this.mc.resolution.getScaledWidthScreenCoords(); int height = this.mc.resolution.getScaledHeightScreenCoords(); - int sp = (int) ((GameSettings.SCREEN_PADDING.value * height) / 8); this.mc.worldRenderer.setupScaledResolution(); GLRenderer.enableState(State.BLEND); @@ -117,7 +113,7 @@ public class HudIngame extends Gui { for (final HudComponent component : HudComponents.INSTANCE.getComponents()) { if (component.isVisible()) { GLRenderer.pushFrame(); - component.render(this, width - sp * 2, height - sp * 2, partialTicks); + component.render(this, width, height, partialTicks); GLRenderer.popFrame(); } } @@ -140,7 +136,7 @@ public class HudIngame extends Gui { //Text Overlays if (GameSettings.IMMERSIVE_MODE.drawOverlays()) { - drawRecordPlayingOverlay(width, height - sp, partialTicks); + drawRecordPlayingOverlay(width, height, partialTicks); boolean clock = false; boolean compass = false; @@ -168,7 +164,7 @@ public class HudIngame extends Gui { } // Show Player List - if (!GameSettings.SHOW_DEBUG_SCREEN.value) drawPlayerList(width, height, sp); + if (!GameSettings.SHOW_DEBUG_SCREEN.value) drawPlayerList(width, height); if (GameSettings.SHOW_DEBUG_SCREEN.value) { GLRenderer.pushFrame(); @@ -391,7 +387,7 @@ public class HudIngame extends Gui { } if (GameSettings.IMMERSIVE_MODE.drawChat()) { - drawChat(width, height, sp); + drawChat(width, height); } // Adding this mostly to see if the stitcher and dynamic textures are working properly @@ -460,7 +456,7 @@ public class HudIngame extends Gui { private final List playerListScoreStrings = new ArrayList<>(); - public void drawPlayerList(int screenWidth, int screenHeight, int screenPadding) { + public void drawPlayerList(int screenWidth, int screenHeight) { if (!this.mc.isMultiplayerWorld()) return; if (GameSettings.PLAYER_LIST_POSITION.value == 1) { GameSettings.SHOW_PLAYER_LIST.value = GameSettings.KEY_PLAYER_LIST.isPressed() && this.mc.currentScreen == null; @@ -504,17 +500,17 @@ public class HudIngame extends Gui { int height = rows * lineHeight + innerPadding * (rows - 1) + 2 + outerPadding - innerPadding + 2; int listX = 0; - int listY = screenPadding; + int listY = 0; if (GameSettings.PLAYER_LIST_POSITION.value == 0) { listX = (screenWidth - width) / 2; } if (GameSettings.PLAYER_LIST_POSITION.value == 1) { listX = (screenWidth - width) / 2; - listY = screenHeight / 6 + screenPadding; + listY = screenHeight / 6; } if (GameSettings.PLAYER_LIST_POSITION.value == 2) { - listX = screenWidth - width - screenPadding; + listX = screenWidth - width; } drawRect(listX, listY, listX + width, listY + height, 0xA8080808); @@ -558,7 +554,7 @@ public class HudIngame extends Gui { } } - public void drawChat(int width, int height, int sp) { + public void drawChat(int width, int height) { if (GameSettings.chatVisibility.value == ChatVisibility.NEVER_SHOW) return; // if(mc.currentScreen instanceof ScreenChat && ((ScreenChat) mc.currentScreen).message.startsWith("/")) return; int linesToShow = 10; @@ -605,9 +601,9 @@ public class HudIngame extends Gui { final byte xPad = 2; final int h = MathHelper.ceil(this.fontRenderer.heightOfConstrainedChars(message, MAX_CHAT_WIDTH)); y -= (h + 2); - drawRect(xPad + sp, y - sp - 1, xPad + MAX_CHAT_WIDTH, y + h - sp + 1, alpha / 2 << 24); + drawRect(xPad, y - 1, xPad + MAX_CHAT_WIDTH, y + h + 1, alpha / 2 << 24); GLRenderer.enableState(State.BLEND); - this.fontRenderer.renderWidthConstrained(message, xPad + sp, y - sp, MAX_CHAT_WIDTH).setShadow().setColor(0xFFFFFF + (alpha << 24)).call(); + this.fontRenderer.renderWidthConstrained(message, xPad, y, MAX_CHAT_WIDTH).setShadow().setColor(0xFFFFFF + (alpha << 24)).call(); } } diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponent.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponent.java index 523b663e2..b21e0784a 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponent.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponent.java @@ -7,10 +7,17 @@ import net.minecraft.client.gui.hud.HudIngame; import net.minecraft.client.gui.hud.component.layout.LayoutAbsolute; import net.minecraft.client.gui.hud.component.layout.Layout; import net.minecraft.client.gui.hud.component.layout.LayoutSnap; +import net.minecraft.client.gui.options.components.KeyBindingComponent; +import net.minecraft.client.gui.options.components.OptionsComponent; +import net.minecraft.client.option.KeyBinding; import net.minecraft.client.option.Option; import net.minecraft.client.render.renderer.GLRenderer; import net.minecraft.client.render.renderer.State; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; + public abstract class HudComponent { protected static final Minecraft mc = Minecraft.getMinecraft(); @@ -18,6 +25,12 @@ public abstract class HudComponent { private final int xSize; private final int ySize; + private final List> rawOptions = new ArrayList<>(); + private final List> optionComponentSuppliers = new ArrayList<>(); + + private final List rawKeyBindings = new ArrayList<>(); + private final List> keyBindingComponentSuppliers = new ArrayList<>(); + Layout layout; public HudComponent(String key, int xSize, int ySize, Layout layout) { @@ -48,30 +61,72 @@ public abstract class HudComponent { return key; } - public int getXSize() { + public int getDisplayedXSize() { if (!isEnabled() || (!(mc.currentScreen instanceof ScreenHudEditor) && !isVisible())) return 0; return xSize; } - public int getYSize() { + public int getDisplayedYSize() { if (!isEnabled() || (!(mc.currentScreen instanceof ScreenHudEditor) && !isVisible())) return 0; return ySize; } - public int getAnchorX(ComponentAnchor anchor) { - return (int) (anchor.xPosition * this.getXSize()); + public int getDisplayedAnchorX(ComponentAnchor anchor) { + return (int) (anchor.xPosition * this.getDisplayedXSize()); + } + + public int getDisplayedAnchorY(ComponentAnchor anchor) { + return (int) (anchor.yPosition * this.getDisplayedYSize()); + } + + public int getTrueXSize() { + return xSize; + } + + public int getTrueYSize() { + return ySize; } - public int getAnchorY(ComponentAnchor anchor) { - return (int) (anchor.yPosition * this.getYSize()); + public int getTrueAnchorX(ComponentAnchor anchor) { + return (int) (anchor.xPosition * this.getTrueXSize()); + } + + public int getTrueAnchorY(ComponentAnchor anchor) { + return (int) (anchor.yPosition * this.getTrueYSize()); } public Layout getLayout() { return layout; } - public Option getAttachedOption() { - return null; + @SuppressWarnings("unchecked") + public T addAttachedOption(Option option, Supplier supplier) { + this.rawOptions.add(option); + this.optionComponentSuppliers.add(supplier); + return (T) this; + } + + @SuppressWarnings("unchecked") + public T addAttachedKeyBinding(KeyBinding keyBinding, Supplier supplier) { + this.rawKeyBindings.add(keyBinding); + this.keyBindingComponentSuppliers.add(supplier); + return (T) this; + } + + public List> getOptionSuppliers() { + return this.optionComponentSuppliers; + } + + public List> getKeyBindingSuppliers() { + return this.keyBindingComponentSuppliers; + } + + public List> getRawOptions() { + return this.rawOptions; + } + + public List getRawKeyBindings() { + return this.rawKeyBindings; } public abstract void render(HudIngame hud, int xSizeScreen, int ySizeScreen, float partialTick); diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorBar.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorBar.java index 4bbb7f230..e0cb5f672 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorBar.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorBar.java @@ -1,70 +1,216 @@ package net.minecraft.client.gui.hud.component; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScreenHudEditor; import net.minecraft.client.gui.hud.HudIngame; import net.minecraft.client.gui.hud.component.layout.Layout; import net.minecraft.client.option.GameSettings; -import net.minecraft.client.option.Option; import net.minecraft.client.render.renderer.GLRenderer; import net.minecraft.client.render.renderer.State; import net.minecraft.client.render.texture.stitcher.IconCoordinate; import net.minecraft.client.render.texture.stitcher.TextureRegistry; +import net.minecraft.core.enums.ArmorHiddenState; +import net.minecraft.core.enums.HumanArmorShape; +import net.minecraft.core.enums.IArmorShape; +import net.minecraft.core.item.Item; +import net.minecraft.core.item.ItemArmor; +import net.minecraft.core.item.ItemStack; +import net.minecraft.core.item.Items; +import net.minecraft.core.item.block.ItemBlock; +import net.minecraft.core.item.material.ArmorMaterial; +import org.jetbrains.annotations.Nullable; -public class HudComponentArmorBar - extends HudComponentMovable { - private final IconCoordinate armor_empty; - private final IconCoordinate armor_half; - private final IconCoordinate armor_full; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; - public HudComponentArmorBar(String key, Layout layout) { - super(key, 81, 10, layout); - this.armor_empty = TextureRegistry.getTexture("minecraft:gui/hud/armor_empty"); - this.armor_half = TextureRegistry.getTexture("minecraft:gui/hud/armor_half"); - this.armor_full = TextureRegistry.getTexture("minecraft:gui/hud/armor_full"); +public class HudComponentArmorBar extends HudComponentMovable { + + private final Random random = new Random(); + + public record CustomItemData(IArmorShape shape, String id) {} + + public static final Map SHAPE_MAP = new HashMap<>(); + public static final Map MATERIAL_MAP = new HashMap<>(); + public static final Map CUSTOM_ITEM_MAP = new HashMap<>(); + + static { + SHAPE_MAP.put(HumanArmorShape.HEAD, "helmet"); + SHAPE_MAP.put(HumanArmorShape.CHEST, "chestplate"); + SHAPE_MAP.put(HumanArmorShape.LEGS, "leggings"); + SHAPE_MAP.put(HumanArmorShape.BOOTS, "boots"); + + MATERIAL_MAP.put(ArmorMaterial.LEATHER, "leather"); + MATERIAL_MAP.put(ArmorMaterial.IRON, "iron"); + MATERIAL_MAP.put(ArmorMaterial.GOLD, "gold"); + MATERIAL_MAP.put(ArmorMaterial.CHAINMAIL, "chainmail"); + MATERIAL_MAP.put(ArmorMaterial.DIAMOND, "diamond"); + MATERIAL_MAP.put(ArmorMaterial.STEEL, "steel"); + + CUSTOM_ITEM_MAP.put(Items.ARMOR_BOOTS_ICESKATES, new CustomItemData(HumanArmorShape.BOOTS, "iceskates")); + CUSTOM_ITEM_MAP.put(Items.ARMOR_QUIVER, new CustomItemData(HumanArmorShape.CHEST, "quiver")); + CUSTOM_ITEM_MAP.put(Items.ARMOR_QUIVER_GOLD, new CustomItemData(HumanArmorShape.CHEST, "quiver_gold")); + } + + public enum ArmorState { + EMPTY, HALF, FULL, INFINITE; + + public String getRegistry() { + return this.name().toLowerCase(); + } + + public static ArmorState calculate(double currentDurability, double maxDurability) { + if (maxDurability <= 0) return INFINITE; + if (currentDurability <= 0) return EMPTY; + + double durabilityPercentage = currentDurability / maxDurability; + + if (durabilityPercentage > 0.50) return FULL; + return HALF; + } + } + + private record ArmorIconKey(IArmorShape shape, ArmorState state, @Nullable ArmorMaterial material, boolean isFlipped) {} + private record CustomIconKey(IArmorShape shape, ArmorState state, String customId, boolean isFlipped) {} + + private record ArmorPiece(IArmorShape shape, @Nullable ArmorMaterial material, @Nullable String customId, ArmorState state, double currentDurability, double maxDurability) { + public boolean isCustom() { + return customId != null; + } + } + + private final IArmorShape targetShape; + + private final Map icons = new HashMap<>(); + private final Map customIcons = new HashMap<>(); + + public HudComponentArmorBar(String key, Layout layout, IArmorShape targetShape) { + super(key, 9, 12, layout); + this.targetShape = targetShape; } @Override - public boolean isVisible() { - return GameSettings.IMMERSIVE_MODE.drawHotbar() && mc.thePlayer.getPlayerProtectionAmount() > 0 && GameSettings.ARMOR_BAR_OVERLAY.value; + public int getDisplayedYSize() { + int baseSize = super.getDisplayedYSize(); + if (baseSize == 0) return 0; + + if (mc.currentScreen instanceof ScreenHudEditor) { + return 12; + } + + ArmorPiece piece = getWornArmorPiece(); + if (piece == null || piece.state() == ArmorState.EMPTY) { + return 9; + } + + return 12; + } + + private boolean isFlipped() { + if (this.targetShape == HumanArmorShape.HEAD) return GameSettings.FLIP_HELMET_BAR.value; + if (this.targetShape == HumanArmorShape.CHEST) return GameSettings.FLIP_CHESTPLATE_BAR.value; + if (this.targetShape == HumanArmorShape.LEGS) return GameSettings.FLIP_LEGGINGS_BAR.value; + if (this.targetShape == HumanArmorShape.BOOTS) return GameSettings.FLIP_BOOTS_BAR.value; + return false; + } + + private ArmorHiddenState getHiddenState() { + if (this.targetShape == HumanArmorShape.HEAD) return GameSettings.HIDE_HELMET_BAR.value; + if (this.targetShape == HumanArmorShape.CHEST) return GameSettings.HIDE_CHESTPLATE_BAR.value; + if (this.targetShape == HumanArmorShape.LEGS) return GameSettings.HIDE_LEGGINGS_BAR.value; + if (this.targetShape == HumanArmorShape.BOOTS) return GameSettings.HIDE_BOOTS_BAR.value; + return ArmorHiddenState.NEVER; + } + + private IconCoordinate getIconForState(ArmorPiece piece, boolean isFlipped) { + if (piece.isCustom()) { + CustomIconKey key = new CustomIconKey(piece.shape(), piece.state(), piece.customId(), isFlipped); + return customIcons.computeIfAbsent(key, this::loadCustomIcon); + } else { + ArmorMaterial fetchMaterial = (piece.state() == ArmorState.EMPTY) ? null : piece.material(); + ArmorIconKey key = new ArmorIconKey(piece.shape(), piece.state(), fetchMaterial, isFlipped); + return icons.computeIfAbsent(key, this::loadArmorIcon); + } + } + + private IconCoordinate loadCustomIcon(CustomIconKey key) { + String shapeDir = SHAPE_MAP.getOrDefault(key.shape(), "unknown"); + + boolean applyFlip = key.isFlipped() && key.state() == ArmorState.HALF; + String stateDir = key.state().getRegistry() + (applyFlip ? "/flipped" : ""); + + String path = "minecraft:gui/hud/armor/" + shapeDir + "/" + stateDir + "/" + key.customId(); + return TextureRegistry.getTexture(path); + } + + private IconCoordinate loadArmorIcon(ArmorIconKey key) { + String shapeDir = SHAPE_MAP.getOrDefault(key.shape(), "unknown"); + + boolean applyFlip = key.isFlipped() && key.state() == ArmorState.HALF; + String stateDir = key.state().getRegistry() + (applyFlip ? "/flipped" : ""); + + if (key.state() == ArmorState.EMPTY) { + String path = "minecraft:gui/hud/armor/" + shapeDir + "/" + stateDir + "/empty"; + return TextureRegistry.getTexture(path); + } else { + String matDir = MATERIAL_MAP.getOrDefault(key.material(), "unknown"); + String path = "minecraft:gui/hud/armor/" + shapeDir + "/" + stateDir + "/" + matDir; + return TextureRegistry.getTexture(path); + } } @Override - public boolean isPreviewTranslucent() { - return !GameSettings.ARMOR_BAR_OVERLAY.value; + public boolean isVisible() { + ArmorHiddenState hiddenState = getHiddenState(); + + if (hiddenState == ArmorHiddenState.ALWAYS) { + return false; + } + + if (!GameSettings.IMMERSIVE_MODE.drawHotbar()) { + return false; + } + + if (hiddenState == ArmorHiddenState.WHEN_NOT_WEARING) { + ArmorPiece piece = getWornArmorPiece(); + return piece != null && piece.state() != ArmorState.EMPTY; + } + + return true; } @Override - public Option getAttachedOption() { - return GameSettings.ARMOR_BAR_OVERLAY; + public boolean isPreviewTranslucent() { + return getHiddenState() == ArmorHiddenState.ALWAYS; } @Override public void render(HudIngame hud, int xSizeScreen, int ySizeScreen, float partialTick) { + ArmorPiece piece = getWornArmorPiece(); + + if (piece == null) { + piece = new ArmorPiece(this.targetShape, null, null, ArmorState.EMPTY, 0, 0); + } + int x = this.getLayout().getComponentX(this, xSizeScreen); int y = this.getLayout().getComponentY(this, ySizeScreen); - // Setup rendering - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color - GLRenderer.disableState(State.BLEND); + int iconY = y; - int armorValue = mc.thePlayer.getPlayerProtectionAmount(); - for (int i = 0; i < 10; i++) { - if (armorValue > 0) { - int xArmor = x + getXSize() - i * 8 - 9; - if (i * 2 + 1 < armorValue) { - // Full armor icon - hud.drawGuiIcon(xArmor, y, 9, 9, this.armor_full); - } - if (i * 2 + 1 == armorValue) { - // Half armor icon - hud.drawGuiIcon(xArmor, y, 9, 9, this.armor_half); - } - if (i * 2 + 1 > armorValue) { - // Empty armor icon - hud.drawGuiIcon(xArmor, y, 9, 9, this.armor_empty); - } - } + if (piece.maxDurability() > 0 && (piece.currentDurability() / piece.maxDurability()) <= 0.15 && piece.state() != ArmorState.EMPTY) { + this.random.setSeed(hud.updateCounter * 0x4c627L); + iconY += this.random.nextInt(2); } + + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); + GLRenderer.enableState(State.BLEND); + + boolean isFlipped = this.isFlipped(); + + hud.drawGuiIcon(x, iconY, 9, 9, getIconForState(piece, isFlipped)); + drawDurabilityBar(hud, x, y, piece.state(), piece.currentDurability(), piece.maxDurability(), 0xFF, isFlipped); + + GLRenderer.disableState(State.BLEND); } @Override @@ -72,26 +218,97 @@ public class HudComponentArmorBar int x = layout.getComponentX(this, xSizeScreen); int y = layout.getComponentY(this, ySizeScreen); - // Setup rendering - + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); renderTranslucency(); - int armorValue = 11; - for (int i = 0; i < 10; i++) { - int xArmor = x + getXSize() - i * 8 - 9; - if (i * 2 + 1 < armorValue) { - // Full armor icon - gui.drawGuiIcon(xArmor, y, 9, 9, this.armor_full); - } - if (i * 2 + 1 == armorValue) { - // Half armor icon - gui.drawGuiIcon(xArmor, y, 9, 9, this.armor_half); + ArmorPiece previewPiece; + int alpha = isPreviewTranslucent() ? 0x55 : 0xFF; + + if (this.targetShape == HumanArmorShape.HEAD) { + previewPiece = new ArmorPiece(this.targetShape, ArmorMaterial.LEATHER, null, ArmorState.HALF, 45, 100); + } else if (this.targetShape == HumanArmorShape.CHEST) { + previewPiece = new ArmorPiece(this.targetShape, ArmorMaterial.IRON, null, ArmorState.HALF, 35, 100); + } else if (this.targetShape == HumanArmorShape.LEGS) { + previewPiece = new ArmorPiece(this.targetShape, ArmorMaterial.GOLD, null, ArmorState.HALF, 25, 100); + } else { + previewPiece = new ArmorPiece(this.targetShape, ArmorMaterial.DIAMOND, null, ArmorState.HALF, 15, 100); + } + + boolean isFlipped = this.isFlipped(); + + gui.drawGuiIcon(x, y, 9, 9, getIconForState(previewPiece, isFlipped)); + drawDurabilityBar(gui, x, y, previewPiece.state(), previewPiece.currentDurability(), previewPiece.maxDurability(), alpha, isFlipped); + + GLRenderer.disableState(State.BLEND); + } + + private void drawDurabilityBar(Gui gui, int x, int y, ArmorState state, double currentDurability, double maxDurability, int alpha, boolean isFlipped) { + int barMaxWidth = 9; + int barY = y + 10; + + int a = alpha << 24; + + gui.drawRect(x, barY, x + 9, barY + 2, a); + + if (state == ArmorState.INFINITE) { + int magentaColor = (0xFFFF00FF & 0x00FFFFFF) | a; + gui.drawRect(x, barY, x + barMaxWidth, barY + 1, magentaColor); + return; + } + + if (maxDurability <= 0) barMaxWidth = 8; + + int barWidth = (int) Math.round((currentDurability / maxDurability) * barMaxWidth); + int progress = (int) Math.round((currentDurability / maxDurability) * 255D); + + int colorFG = java.awt.Color.HSBtoRGB(progress / 255F / 3F, 1f, 1f); + int colorBG = ((0xFF - progress) / 4) << 16 | 0x3f00; + + colorFG = (colorFG & 0x00FFFFFF) | a; + colorBG = (colorBG & 0x00FFFFFF) | a; + + gui.drawRect(x, barY, x + barMaxWidth, barY + 1, colorBG); + + if (barWidth > 0) { + if (isFlipped) { + int startX = x + barMaxWidth - barWidth; + gui.drawRect(startX, barY, startX + barWidth, barY + 1, colorFG); + } else { + gui.drawRect(x, barY, x + barWidth, barY + 1, colorFG); } - if (i * 2 + 1 > armorValue) { - // Empty armor icon - gui.drawGuiIcon(xArmor, y, 9, 9, this.armor_empty); + } + } + + private @Nullable ArmorPiece getWornArmorPiece() { + if (mc.thePlayer == null) return null; + + for (ItemStack itemStack : mc.thePlayer.inventory.armorInventory) { + if (itemStack == null) continue; + + Item item = itemStack.getItem(); + + if (CUSTOM_ITEM_MAP.containsKey(item)) { + CustomItemData data = CUSTOM_ITEM_MAP.get(item); + if (data.shape() == this.targetShape) { + double maxDurability = itemStack.getMaxDamage(); + double currentDurability = maxDurability > 0 ? maxDurability - itemStack.getItemDamageForDisplay() : 0; + ArmorState state = ArmorState.calculate(currentDurability, maxDurability); + return new ArmorPiece(this.targetShape, null, data.id(), state, currentDurability, maxDurability); + } + } else if (item instanceof ItemArmor armor) { + if (armor.getArmorShape() == this.targetShape) { + ArmorMaterial material = armor.getArmorMaterial(); + double maxDurability = itemStack.getMaxDamage(); + double currentDurability = maxDurability > 0 ? maxDurability - itemStack.getItemDamageForDisplay() : 0; + ArmorState state = ArmorState.calculate(currentDurability, maxDurability); + return new ArmorPiece(this.targetShape, material, null, state, currentDurability, maxDurability); + } + } else if (this.targetShape == HumanArmorShape.HEAD) { + String customId = (item instanceof ItemBlock) ? "block_generic" : "item_generic"; + return new ArmorPiece(this.targetShape, null, customId, ArmorState.INFINITE, 0, 0); } } - GLRenderer.disableState(State.BLEND); + + return null; } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorDurability.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorDurability.java index 38ff5b86e..d6526d6fd 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorDurability.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentArmorDurability.java @@ -35,11 +35,6 @@ public class HudComponentArmorDurability return !GameSettings.ARMOR_DURABILITY_OVERLAY.value; } - @Override - public Option getAttachedOption() { - return GameSettings.ARMOR_DURABILITY_OVERLAY; - } - @Override public void render(HudIngame hud, int xSizeScreen, int ySizeScreen, float partialTick) { int x = this.getLayout().getComponentX(this, xSizeScreen); diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentDynamicTooltip.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentDynamicTooltip.java new file mode 100644 index 000000000..df19902d8 --- /dev/null +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentDynamicTooltip.java @@ -0,0 +1,169 @@ +package net.minecraft.client.gui.hud.component; + +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScreenHudEditor; +import net.minecraft.client.gui.hud.HudIngame; +import net.minecraft.client.gui.hud.component.layout.Layout; +import net.minecraft.client.option.GameSettings; +import net.minecraft.client.option.Option; +import net.minecraft.client.render.renderer.BlendFactor; +import net.minecraft.client.render.renderer.GLRenderer; +import net.minecraft.client.render.renderer.State; +import net.minecraft.core.entity.Mob; +import net.minecraft.core.item.ItemStack; +import net.minecraft.client.util.helper.Colors; +import net.minecraft.core.util.helper.Time; +import org.jetbrains.annotations.NotNull; + +public class HudComponentDynamicTooltip extends HudComponentMovable { + + private int lastItemID = -1; + private int lastSelectedItem = -1; + + private String itemString; + private int itemColor; + private double itemTime = 0.0; + + private String systemString; + private int systemColor; + private double systemTime = 0.0; + + private final double displayTime = 2.5; + private final double fadeTime = 0.5; + + private final String PREVIEW_TEXT = "Diamond Pickaxe"; + + public HudComponentDynamicTooltip(String key, Layout layout) { + super(key, 0, 8, layout); + } + + @Override + public boolean isVisible() { + if (mc.thePlayer == null) { + return GameSettings.IMMERSIVE_MODE.drawHotbar(); + } + return GameSettings.IMMERSIVE_MODE.drawHotbar() && !GameSettings.HIDE_DYNAMIC_TOOLTIP.value; + } + + @Override + public boolean isPreviewTranslucent() { + return GameSettings.HIDE_DYNAMIC_TOOLTIP.value; + } + + @Override + public int getDisplayedXSize() { + if (!isEnabled() || (!(mc.currentScreen instanceof ScreenHudEditor) && !isVisible())) return 0; + return mc.font.stringWidth(getDisplayText()); + } + + @Override + public int getTrueXSize() { + return mc.font.stringWidth(getDisplayText()); + } + + private String getDisplayText() { + if (mc.currentScreen instanceof ScreenHudEditor) return PREVIEW_TEXT; + + if (this.systemString != null && this.systemTime > 0.0) return this.systemString; + if (this.itemString != null && this.itemTime > 0.0) return this.itemString; + + return ""; + } + + @Override + public void render(HudIngame hud, int xSizeScreen, int ySizeScreen, float partialTick) { + if (!isVisible()) return; + + if (mc.thePlayer != null) { + ItemStack item = mc.thePlayer.getCurrentEquippedItem(); + int id = getItemID(item); + int i = mc.thePlayer.inventory.getCurrentSlot(); + + if (id != this.lastItemID || i != this.lastSelectedItem) { + updateItemString(item); + this.itemTime = this.displayTime; + this.lastItemID = id; + this.lastSelectedItem = i; + this.systemTime = 0.0; + } + } + + if (!mc.isGamePaused) { + if (this.systemTime > 0.0) this.systemTime -= Time.delta; + if (this.itemTime > 0.0) this.itemTime -= Time.delta; + } + + String activeString = null; + int activeColor = 0; + double activeTime = -1.0; + + if (this.systemString != null && this.systemTime > 0.0) { + activeString = this.systemString; + activeColor = this.systemColor; + activeTime = this.systemTime; + } else if (this.itemString != null && this.itemTime > 0.0) { + activeString = this.itemString; + activeColor = this.itemColor; + activeTime = this.itemTime; + } + + if (activeString == null || activeTime <= 0.0) return; + + double alpha = (activeTime < this.fadeTime) ? (activeTime / this.fadeTime) : 1.0; + int a = (int) (alpha * 255); + if (a < 1) return; + + int rgb = (activeColor & 0x00FFFFFF) | (a << 24); + + int x = this.getLayout().getComponentX(this, xSizeScreen); + int y = this.getLayout().getComponentY(this, ySizeScreen); + + if (a < 255) { + GLRenderer.enableState(State.BLEND); + GLRenderer.setBlendFunc(BlendFactor.SRC_ALPHA, BlendFactor.ONE_MINUS_SRC_ALPHA); + } + + mc.font.render(activeString, x, y).setShadow().setColor(rgb).call(); + + GLRenderer.disableState(State.BLEND); + } + + @Override + public void renderPreview(Gui gui, Layout layout, int xSizeScreen, int ySizeScreen) { + int x = layout.getComponentX(this, xSizeScreen); + int y = layout.getComponentY(this, ySizeScreen); + + renderTranslucency(); + + int rgb = (0x00FFFFFF) | (255 << 24); + mc.font.render(PREVIEW_TEXT, x, y).setShadow().setColor(rgb).call(); + } + + private void updateItemString(ItemStack item) { + if (item == null) { + this.itemString = null; + return; + } + this.itemString = item.getDisplayName(); + this.itemColor = Colors.allChatColors[item.getDisplayColor()].getARGB(); + } + + private int getItemID(ItemStack stack) { + if (stack == null) return -1; + return stack.getItem().id; + } + + public void setOptionNameAndValueString(@NotNull Option option) { + setString(option.getDisplayStringName() + ": " + option.getDisplayString()); + } + + public void setString(String string) { + setString(string, 0xFFFFFF); + } + + public void setString(String string, int color) { + this.systemString = string; + this.systemColor = color; + this.systemTime = this.displayTime; + } +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentFireBar.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentFireBar.java index 62da02c17..cf9ade42a 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentFireBar.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentFireBar.java @@ -8,15 +8,54 @@ import net.minecraft.client.render.renderer.GLRenderer; import net.minecraft.client.render.renderer.State; import net.minecraft.client.render.texture.stitcher.TextureRegistry; -public class HudComponentFireBar - extends HudComponentMovable { +public class HudComponentFireBar extends HudComponentMovable { + public HudComponentFireBar(String key, Layout layout) { - super(key, 81, 10, layout); + super(key, 81, 9, layout); + } + + private boolean isVertical() { + return GameSettings.VERTICAL_FIRE_BAR.value; + } + + private boolean isFlipped() { + return GameSettings.FLIP_FIRE_BAR.value; + } + + @Override + public int getDisplayedXSize() { + return this.isVertical() ? super.getDisplayedYSize() : super.getDisplayedXSize(); + } + + @Override + public int getDisplayedYSize() { + return this.isVertical() ? super.getDisplayedXSize() : super.getDisplayedYSize(); + } + + @Override + public int getTrueXSize() { + return this.isVertical() ? super.getTrueYSize() : super.getTrueXSize(); + } + + @Override + public int getTrueYSize() { + return this.isVertical() ? super.getTrueXSize() : super.getTrueYSize(); } @Override public boolean isVisible() { - return GameSettings.IMMERSIVE_MODE.drawHotbar() && !mc.thePlayer.getGamemode().hasInvulnerablePlayer() && mc.thePlayer.remainingFireTicks > 0; + if (mc.thePlayer == null) { + return GameSettings.IMMERSIVE_MODE.drawHotbar(); + } + return GameSettings.IMMERSIVE_MODE.drawHotbar() && + !mc.thePlayer.getGamemode().hasInvulnerablePlayer() && + mc.thePlayer.remainingFireTicks > 0 && + !GameSettings.HIDE_FIRE_BAR.value; + } + + @Override + public boolean isPreviewTranslucent() { + return GameSettings.HIDE_FIRE_BAR.value; } @Override @@ -31,8 +70,22 @@ public class HudComponentFireBar float fire = (float) mc.thePlayer.remainingFireTicks / (float) mc.thePlayer.maxFireTicks; int fireBar = (int) Math.min(fire * 20, 20); + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + for (int i = 0; i < fireBar / 2; i++) { - hud.drawGuiIcon(x + i * 8, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/fire")); + int xIcon; + int yIcon; + + if (isVertical) { + xIcon = x; + yIcon = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + } else { + xIcon = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yIcon = y; + } + + hud.drawGuiIcon(xIcon, yIcon, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/fire")); } } @@ -43,11 +96,26 @@ public class HudComponentFireBar // Setup rendering GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + renderTranslucency(); GLRenderer.enableState(State.BLEND); - int fireBar = 11; + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + + int fireBar = 11; for (int i = 0; i < fireBar / 2; i++) { - gui.drawGuiIcon(x + i * 8, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/fire")); + int xIcon; + int yIcon; + + if (isVertical) { + xIcon = x; + yIcon = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + } else { + xIcon = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yIcon = y; + } + + gui.drawGuiIcon(xIcon, yIcon, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/fire")); } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHealthBar.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHealthBar.java index 3e16b341e..e35788124 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHealthBar.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHealthBar.java @@ -17,17 +17,52 @@ import net.minecraft.core.util.phys.HitResult; import java.util.Random; -public class HudComponentHealthBar - extends HudComponentMovable { +public class HudComponentHealthBar extends HudComponentMovable { private final Random random = new Random(); public HudComponentHealthBar(String key, Layout layout) { - super(key, 81, 10, layout); + super(key, 81, 9, layout); + } + + private boolean isVertical() { + return GameSettings.VERTICAL_HEALTH_BAR.value; + } + + private boolean isFlipped() { + return GameSettings.FLIP_HEALTH_BAR.value; + } + + @Override + public int getDisplayedXSize() { + return this.isVertical() ? super.getDisplayedYSize() : super.getDisplayedXSize(); + } + + @Override + public int getDisplayedYSize() { + return this.isVertical() ? super.getDisplayedXSize() : super.getDisplayedYSize(); + } + + @Override + public int getTrueXSize() { + return this.isVertical() ? super.getTrueYSize() : super.getTrueXSize(); + } + + @Override + public int getTrueYSize() { + return this.isVertical() ? super.getTrueXSize() : super.getTrueYSize(); } @Override public boolean isVisible() { - return !mc.thePlayer.getGamemode().hasInvulnerablePlayer() && GameSettings.IMMERSIVE_MODE.drawHotbar(); + if (mc.thePlayer == null) { + return GameSettings.IMMERSIVE_MODE.drawHotbar(); + } + return !mc.thePlayer.getGamemode().hasInvulnerablePlayer() && GameSettings.IMMERSIVE_MODE.drawHotbar() && !GameSettings.HIDE_HEALTH_BAR.value; + } + + @Override + public boolean isPreviewTranslucent() { + return GameSettings.HIDE_HEALTH_BAR.value; } @Override @@ -36,49 +71,76 @@ public class HudComponentHealthBar int y = this.getLayout().getComponentY(this, ySizeScreen); // Setup rendering - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); GLRenderer.enableState(State.BLEND); boolean heartsFlash = (mc.thePlayer.heartsFlashTime / 3) % 2 == 1; if (mc.thePlayer.heartsFlashTime < 10) { heartsFlash = false; } + int health = mc.thePlayer.getHealth(); int prevHealth = mc.thePlayer.prevHealth; this.random.setSeed(hud.updateCounter * 0x4c627L); boolean isHardcore = mc.thePlayer.getGamemode() == Gamemodes.HARDCORE; + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + + String styleFolder = isHardcore ? "hardcore/" : "survival/"; + + String halfSuffix = ""; + if (isVertical) { + halfSuffix = isFlipped ? "_vertical_flipped" : "_vertical"; + } else if (isFlipped) { + halfSuffix = "_flipped"; + } + for (int i = 0; i < 10; i++) { int heartOffset = 0; if (heartsFlash) { heartOffset = 1; } - int xHeart = x + i * 8; - int yHeart = y; - if (health <= 4) { - yHeart += this.random.nextInt(2); - } + int xHeart; + int yHeart; + + // Coordinate logic applying both vertical and flipped states + if (isVertical) { + xHeart = x; + yHeart = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + if (health <= 4) { + xHeart += this.random.nextInt(2); // Shake horizontally + } + } else { + xHeart = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yHeart = y; + if (health <= 4) { + yHeart += this.random.nextInt(2); // Shake vertically + } + } + hud.drawGuiIcon(xHeart, yHeart, 9, 9, heartOffset == 0 ? TextureRegistry.getTexture("minecraft:gui/hud/heart/container") : TextureRegistry.getTexture("minecraft:gui/hud/heart/container_blinking")); + + // Flashing Damage/Heal Overlay if (heartsFlash) { if (i * 2 + 1 < prevHealth) { - // Half flash heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "full_blinking")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "full_blinking")); } if (i * 2 + 1 == prevHealth) { - // Full flash heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "half_blinking")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "half_blinking" + halfSuffix)); } } + + // Base Health if (i * 2 + 1 < health) { - // Full heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "full")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "full")); } if (i * 2 + 1 == health) { - // Half heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "half")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "half" + halfSuffix)); } + // Food Regen Overlay if (GameSettings.FOOD_HEALTH_REGEN_OVERLAY.value) { int healing = 0; ItemStack held = mc.thePlayer.getHeldItem(); @@ -94,14 +156,15 @@ public class HudComponentHealthBar healing = edible.getHealAmount(mc.currentWorld, hitTile.tilePos); } } + if (healing > 0) { if (i * 2 + 1 >= health) { if (i * 2 + 1 == health) { - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "preview_half_right")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "preview/half_right" + halfSuffix)); } else if (i * 2 + 1 < health + healing) { - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "preview_full")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "preview/full")); } else if (i * 2 + 1 == health + healing) { - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + (isHardcore ? "hardcore_" : "") + "preview_half")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "preview/half" + halfSuffix)); } } } @@ -114,22 +177,44 @@ public class HudComponentHealthBar int x = layout.getComponentX(this, xSizeScreen); int y = layout.getComponentY(this, ySizeScreen); - // Setup rendering - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); + renderTranslucency(); GLRenderer.enableState(State.BLEND); int health = 11; + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + + String styleFolder = "survival/"; + + String halfSuffix = ""; + if (isVertical) { + halfSuffix = isFlipped ? "_vertical_flipped" : "_vertical"; + } else if (isFlipped) { + halfSuffix = "_flipped"; + } + for (int i = 0; i < 10; i++) { - int xHeart = x + i * 8; - gui.drawGuiIcon(xHeart, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/container")); + int xHeart; + int yHeart; + + if (isVertical) { + xHeart = x; + yHeart = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + } else { + xHeart = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yHeart = y; + } + + // Container + gui.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/container")); + if (i * 2 + 1 < health) { - // Full heart icon - gui.drawGuiIcon(xHeart, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/full")); + gui.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "full")); } if (i * 2 + 1 == health) { - // Half heart icon - gui.drawGuiIcon(xHeart, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/half")); + gui.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/" + styleFolder + "half" + halfSuffix)); } } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHeldItemCount.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHeldItemCount.java index a451c5703..caf04efd0 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHeldItemCount.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHeldItemCount.java @@ -1,10 +1,10 @@ package net.minecraft.client.gui.hud.component; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScreenHudEditor; import net.minecraft.client.gui.hud.HudIngame; import net.minecraft.client.gui.hud.component.layout.Layout; import net.minecraft.client.option.GameSettings; -import net.minecraft.client.option.Option; import net.minecraft.client.render.Lighting; import net.minecraft.client.render.item.model.ItemModelDispatcher; import net.minecraft.client.render.renderer.GLRenderer; @@ -15,93 +15,178 @@ import net.minecraft.core.util.helper.LightIndexHelper; import java.awt.Color; -public class HudComponentHeldItemCount - extends HudComponentMovable { +public class HudComponentHeldItemCount extends HudComponentMovable { private static final ItemStack PREVIEW_ITEM = new ItemStack(Blocks.COBBLE_BASALT, 53); + private static final int ICON_SIZE = 16; + private static final int TEXT_HEIGHT = 8; + private static final int GAP = 2; + private static final int PADDING = 3; public HudComponentHeldItemCount(String key, Layout layout) { - super(key, 53, 22, layout); + super(key, 24, 24, layout); + } + + private boolean isVertical() { + return GameSettings.VERTICAL_HELD_ITEM_COUNT.value; + } + + private boolean isFlipped() { + return GameSettings.FLIP_HELD_ITEM_COUNT.value; + } + + private String getDisplayText() { + if (mc.currentScreen instanceof ScreenHudEditor) { + return String.valueOf(PREVIEW_ITEM.stackSize); + } + + if (mc.thePlayer == null) { + return String.valueOf(PREVIEW_ITEM.stackSize); + } + + ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem(); + if (heldItemStack == null) return null; + + if (heldItemStack.isItemStackDamageable()) { + int remainingDurability = (heldItemStack.getMaxDamage() - heldItemStack.getMetadata()) + 1; + return String.valueOf(remainingDurability); + } else { + int itemCount = 0; + int stackCount = 0; + for (int i = 0; i < mc.thePlayer.inventory.getContainerSize(); i++) { + ItemStack itemStack = mc.thePlayer.inventory.getItem(i); + if (itemStack != null && itemStack.itemID == heldItemStack.itemID && itemStack.getMetadata() == heldItemStack.getMetadata()) { + itemCount += itemStack.stackSize; + stackCount++; + } + } + if (stackCount >= 1) { + return String.valueOf(itemCount); + } + return null; + } } @Override - public boolean isVisible() { - return GameSettings.IMMERSIVE_MODE.drawOverlays() && GameSettings.HELD_ITEM_COUNT_OVERLAY.value; + public int getDisplayedXSize() { + String text = getDisplayText(); + if (text == null) return 0; + + int textWidth = mc.font.stringWidth(text); + + if (this.isVertical()) { + return PADDING * 2 + Math.max(ICON_SIZE, textWidth); + } else { + return PADDING * 2 + ICON_SIZE + GAP + textWidth; + } } @Override - public boolean isPreviewTranslucent() { - return !GameSettings.HELD_ITEM_COUNT_OVERLAY.value; + public int getDisplayedYSize() { + String text = getDisplayText(); + if (text == null) return 0; + + if (this.isVertical()) { + return PADDING * 2 + ICON_SIZE + GAP + TEXT_HEIGHT; + } else { + return PADDING * 2 + Math.max(ICON_SIZE, TEXT_HEIGHT); + } } @Override - public Option getAttachedOption() { - return GameSettings.HELD_ITEM_COUNT_OVERLAY; + public int getTrueXSize() { + return getDisplayedXSize(); } @Override - public void render(HudIngame hud, int xSizeScreen, int ySizeScreen, float partialTick) { - int x = this.getLayout().getComponentX(this, xSizeScreen); - int y = this.getLayout().getComponentY(this, ySizeScreen); + public int getTrueYSize() { + return getDisplayedYSize(); + } - int xx = x + 3; - int yy = y + 3; + @Override + public boolean isVisible() { + return GameSettings.IMMERSIVE_MODE.drawOverlays() && !GameSettings.HIDE_HELD_ITEM_COUNT.value; + } - ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem(); - if (heldItemStack != null) { - boolean renderItem; + @Override + public boolean isPreviewTranslucent() { + return GameSettings.HIDE_HELD_ITEM_COUNT.value; + } - if (heldItemStack.isItemStackDamageable()) { - renderItem = true; - float durability = (heldItemStack.getMaxDamage() - heldItemStack.getMetadata()) / (float) heldItemStack.getMaxDamage(); + private void drawComponent(int x, int y, ItemStack itemStack, String text, float partialTick) { + if (itemStack == null || text == null) return; - final int color = 0xFF000000 + Color.HSBtoRGB(durability / 3F, 1f, 1f); - int remainingDurability = (heldItemStack.getMaxDamage() - heldItemStack.getMetadata()) + 1; - mc.font.render(remainingDurability, xx + 18, yy + 4).setShadow().setColor(color).call(); - } else { - int itemCount = 0; - int stackCount = 0; - for (int i = 0; i < mc.thePlayer.inventory.getContainerSize(); i++) { - ItemStack itemStack = mc.thePlayer.inventory.getItem(i); - if (itemStack != null && itemStack.itemID == heldItemStack.itemID && itemStack.getMetadata() == heldItemStack.getMetadata()) { - itemCount += itemStack.stackSize; - stackCount++; - } - } - renderItem = stackCount >= 1; + int textWidth = mc.font.stringWidth(text); + int xx, yy, tx, ty; - if (renderItem) { - mc.font.render(itemCount, xx + 18, yy + 4).setShadow().setColor(0xFFFFFFFF).call(); - } + if (this.isVertical()) { + int maxWidth = Math.max(ICON_SIZE, textWidth); + if (this.isFlipped()) { + // Flipped Vertical + tx = x + PADDING + (maxWidth - textWidth) / 2; + ty = y + PADDING; + xx = x + PADDING + (maxWidth - ICON_SIZE) / 2; + yy = ty + TEXT_HEIGHT + GAP; + } else { + // Default Vertical + xx = x + PADDING + (maxWidth - ICON_SIZE) / 2; + yy = y + PADDING; + tx = x + PADDING + (maxWidth - textWidth) / 2; + ty = yy + ICON_SIZE + GAP; } - - if (renderItem) { - GLRenderer.enableState(State.DEPTH_TEST); - GLRenderer.disableState(State.BLEND); - Lighting.enableInventoryLight(); - ItemModelDispatcher.getInstance().getDispatch(heldItemStack).renderGui(GLRenderer.getTessellator(), null, heldItemStack, xx, yy, LightIndexHelper.lightIndex2i(15, 15), partialTick); - Lighting.disable(); + } else { + if (this.isFlipped()) { + // Flipped Horizontal + tx = x + PADDING; + ty = y + PADDING + (ICON_SIZE - TEXT_HEIGHT) / 2; + xx = tx + textWidth + GAP; + yy = y + PADDING; + } else { + // Default Horizontal + xx = x + PADDING; + yy = y + PADDING; + tx = xx + ICON_SIZE + GAP; + ty = y + PADDING + (ICON_SIZE - TEXT_HEIGHT) / 2; } } + + int color = 0xFFFFFFFF; + if (itemStack.isItemStackDamageable()) { + float durability = (itemStack.getMaxDamage() - itemStack.getMetadata()) / (float) itemStack.getMaxDamage(); + color = 0xFF000000 + Color.HSBtoRGB(durability / 3F, 1f, 1f); + } + mc.font.render(text, tx, ty).setShadow().setColor(color).call(); + + GLRenderer.enableState(State.DEPTH_TEST); + GLRenderer.disableState(State.BLEND); + Lighting.enableInventoryLight(); + ItemModelDispatcher.getInstance().getDispatch(itemStack).renderGui(GLRenderer.getTessellator(), null, itemStack, xx, yy, LightIndexHelper.lightIndex2i(15, 15), partialTick); + Lighting.disable(); + + GLRenderer.disableState(State.DEPTH_TEST); + } + + @Override + public void render(HudIngame hud, int xSizeScreen, int ySizeScreen, float partialTick) { + if (mc.thePlayer == null) return; + + String text = getDisplayText(); + ItemStack heldItemStack = mc.thePlayer.inventory.getCurrentItem(); + + if (heldItemStack != null && text != null) { + int x = this.getLayout().getComponentX(this, xSizeScreen); + int y = this.getLayout().getComponentY(this, ySizeScreen); + + drawComponent(x, y, heldItemStack, text, partialTick); + } } @Override public void renderPreview(Gui gui, Layout layout, int xSizeScreen, int ySizeScreen) { renderTranslucency(); + String text = String.valueOf(PREVIEW_ITEM.stackSize); int x = this.getLayout().getComponentX(this, xSizeScreen); int y = this.getLayout().getComponentY(this, ySizeScreen); - int xx = x + 3; - int yy = y + 3; - - ItemStack heldItemStack = PREVIEW_ITEM; - int itemCount = heldItemStack.stackSize; - - mc.font.render(itemCount, xx + 18, yy + 4).setShadow().setColor(0xFFFFFFFF).call(); - - GLRenderer.enableState(State.DEPTH_TEST); - GLRenderer.disableState(State.BLEND); - Lighting.enableInventoryLight(); - ItemModelDispatcher.getInstance().getDispatch(heldItemStack).renderGui(GLRenderer.getTessellator(), null, heldItemStack, xx, yy, LightIndexHelper.lightIndex2i(15, 15), 0.0f); - Lighting.disable(); + drawComponent(x, y, PREVIEW_ITEM, text, 0.0f); } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHotbar.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHotbar.java index 7d495c082..25b6198b7 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHotbar.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentHotbar.java @@ -20,8 +20,7 @@ import net.minecraft.core.util.helper.LightIndexHelper; import static net.minecraft.client.Minecraft.HOTBAR_SWAP_ANIMATION_LENGTH_TICKS; -public class HudComponentHotbar - extends HudComponentMovable { +public class HudComponentHotbar extends HudComponentMovable { private static final ItemStack[] PREVIEW_ITEMS = new ItemStack[]{ new ItemStack(Blocks.STONE), new ItemStack(Blocks.COBBLE_STONE), @@ -38,17 +37,57 @@ public class HudComponentHotbar super(key, 187, 22, layout); } + private boolean isVertical() { + return GameSettings.VERTICAL_HOT_BAR.value; + } + + @Override + public int getDisplayedXSize() { + return this.isVertical() ? super.getDisplayedYSize() : super.getDisplayedXSize(); + } + + @Override + public int getDisplayedYSize() { + return this.isVertical() ? super.getDisplayedXSize() : super.getDisplayedYSize(); + } + + @Override + public int getTrueXSize() { + return this.isVertical() ? super.getTrueYSize() : super.getTrueXSize(); + } + @Override - public int getAnchorX(ComponentAnchor anchor) { - int xAnchor = super.getAnchorX(anchor); - if (anchor.xPosition == 0.0f) { - xAnchor += 5; - } else if (anchor.xPosition == 0.5f) { - xAnchor += 2; + public int getTrueYSize() { + return this.isVertical() ? super.getTrueXSize() : super.getTrueYSize(); + } + + // Offset anchors to account for the selector dots depending on orientation + @Override + public int getDisplayedAnchorX(ComponentAnchor anchor) { + int xAnchor = super.getDisplayedAnchorX(anchor); + if (!this.isVertical()) { + if (anchor.xPosition == 0.0f) { + xAnchor += 5; + } else if (anchor.xPosition == 0.5f) { + xAnchor += 2; + } } return xAnchor; } + @Override + public int getDisplayedAnchorY(ComponentAnchor anchor) { + int yAnchor = super.getDisplayedAnchorY(anchor); + if (this.isVertical()) { + if (anchor.yPosition == 0.0f) { + yAnchor += 5; + } else if (anchor.yPosition == 0.5f) { + yAnchor += 2; + } + } + return yAnchor; + } + @Override public boolean isVisible() { return GameSettings.IMMERSIVE_MODE.drawHotbar(); @@ -60,125 +99,127 @@ public class HudComponentHotbar int y = this.getLayout().getComponentY(this, ySizeScreen); ContainerInventory inv = mc.thePlayer.inventory; + boolean isVertical = this.isVertical(); - // Setup hotbar texture - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color - - // Render hotbar - hud.drawGuiIcon(x + 5, y, 182, 22, TextureRegistry.getTexture("minecraft:gui/hud/hotbar")); - - // Render hotbar switcher and dots + // Render background textures + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); int selectedHotbar = ((inv.getHotbarOffset() + (ContainerInventory.MAIN_INVENTORY_SIZE - ContainerInventory.HOTBAR_SIZE)) % ContainerInventory.MAIN_INVENTORY_SIZE) / ContainerInventory.HOTBAR_SIZE; - IconCoordinate coordinate = TextureRegistry.getTexture("minecraft:gui/hud/hotbar_selector" + selectedHotbar); - hud.drawGuiIcon(x, y, 6, 22, coordinate); + boolean isLocked = mc.thePlayer.getHeldObject() != null; + + drawOrientedBackgrounds(hud, x, y, selectedHotbar, inv.getCurrentSlot() % ContainerInventory.HOTBAR_SIZE, isLocked, isVertical); // Setup items GLRenderer.enableState(State.DEPTH_TEST); GLRenderer.enableState(State.BLEND); Lighting.enableInventoryLight(); + int lastHotbarStart = (mc.thePlayer.inventory.getHotbarOffset() + (ContainerInventory.MAIN_INVENTORY_SIZE - ContainerInventory.HOTBAR_SIZE)) % ContainerInventory.MAIN_INVENTORY_SIZE; int nextHotbarStart = (mc.thePlayer.inventory.getHotbarOffset() + ContainerInventory.HOTBAR_SIZE) % ContainerInventory.MAIN_INVENTORY_SIZE; // Render hotbars being switched if appropriate if (mc.hotbarSwapAnimationProgress != 0.0f) { - Scissor.enable(x + 8, y + 3, 176, 16); - if (mc.hotbarSwapAnimationProgress > 0) { + // Adjust the scissor box based on orientation + if (isVertical) { + Scissor.enable(x + 3, y + 8, 16, 176); + } else { + Scissor.enable(x + 8, y + 3, 176, 16); + } + + int animOffsetPrev = (int) (22 * (mc.hotbarSwapAnimationProgress - partialTick) / HOTBAR_SWAP_ANIMATION_LENGTH_TICKS); + int animOffsetNext = (int) (22 * (mc.hotbarSwapAnimationProgress + partialTick) / HOTBAR_SWAP_ANIMATION_LENGTH_TICKS); + if (mc.hotbarSwapAnimationProgress > 0) { // Draw last hotbar for (int itemIndex = 0; itemIndex < ContainerInventory.HOTBAR_SIZE; itemIndex++) { - int itemX = x + 8 + itemIndex * 20; - int itemY = y + 3 - 22 + (int) (22 * (mc.hotbarSwapAnimationProgress - partialTick) / HOTBAR_SWAP_ANIMATION_LENGTH_TICKS); + int itemX = isVertical ? (x + 3 - 22 + animOffsetPrev) : (x + 8 + itemIndex * 20); + int itemY = isVertical ? (y + 8 + itemIndex * 20) : (y + 3 - 22 + animOffsetPrev); renderInventorySlot(mc, itemIndex + lastHotbarStart, itemX, itemY, partialTick); } - // Render hotbar items - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + // Render current hotbar items + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); for (int itemIndex = 0; itemIndex < ContainerInventory.HOTBAR_SIZE; itemIndex++) { - int itemX = x + 8 + itemIndex * 20; - int itemY = y + 3 + (int) (22 * (mc.hotbarSwapAnimationProgress - partialTick) / HOTBAR_SWAP_ANIMATION_LENGTH_TICKS); + int itemX = isVertical ? (x + 3 + animOffsetPrev) : (x + 8 + itemIndex * 20); + int itemY = isVertical ? (y + 8 + itemIndex * 20) : (y + 3 + animOffsetPrev); renderInventorySlot(mc, itemIndex + mc.thePlayer.inventory.getHotbarOffset(), itemX, itemY, partialTick); } } else { // Draw next hotbar for (int itemIndex = 0; itemIndex < ContainerInventory.HOTBAR_SIZE; itemIndex++) { - int itemX = x + 8 + itemIndex * 20; - int itemY = y + 3 + 22 + (int) (22 * (mc.hotbarSwapAnimationProgress + partialTick) / HOTBAR_SWAP_ANIMATION_LENGTH_TICKS); + int itemX = isVertical ? (x + 3 + 22 + animOffsetNext) : (x + 8 + itemIndex * 20); + int itemY = isVertical ? (y + 8 + itemIndex * 20) : (y + 3 + 22 + animOffsetNext); renderInventorySlot(mc, itemIndex + nextHotbarStart, itemX, itemY, partialTick); } - // Render hotbar items - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + // Render current hotbar items + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); for (int itemIndex = 0; itemIndex < ContainerInventory.HOTBAR_SIZE; itemIndex++) { - int itemX = x + 8 + itemIndex * 20; - int itemY = y + 3 + (int) (22 * (mc.hotbarSwapAnimationProgress + partialTick) / HOTBAR_SWAP_ANIMATION_LENGTH_TICKS); + int itemX = isVertical ? (x + 3 + animOffsetNext) : (x + 8 + itemIndex * 20); + int itemY = isVertical ? (y + 8 + itemIndex * 20) : (y + 3 + animOffsetNext); renderInventorySlot(mc, itemIndex + mc.thePlayer.inventory.getHotbarOffset(), itemX, itemY, partialTick); } } - - } else { - // Render hotbar items - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + // Render static hotbar items + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); for (int itemIndex = 0; itemIndex < ContainerInventory.HOTBAR_SIZE; itemIndex++) { - int itemX = x + 8 + itemIndex * 20; - int itemY = y + 3; + int itemX = isVertical ? (x + 3) : (x + 8 + itemIndex * 20); + int itemY = isVertical ? (y + 8 + itemIndex * 20) : (y + 3); renderInventorySlot(mc, itemIndex + mc.thePlayer.inventory.getHotbarOffset(), itemX, itemY, partialTick); } } - Scissor.disable(); Lighting.disable(); - - // Setup hotbar texture - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color - - // Render selector - hud.drawGuiIcon((x + 4) + (inv.getCurrentSlot() % ContainerInventory.HOTBAR_SIZE) * 20, y - 1, 24, 24, TextureRegistry.getTexture(mc.thePlayer.getHeldObject() == null ? "minecraft:gui/hud/hotbar_selection" : "minecraft:gui/hud/hotbar_selection_locked")); - - GLRenderer.pushFrame(); - GLRenderer.modelM4f().translate(0, 0, 1f); - hud.heldItemTooltipElement.updateAndRender(mc, x + 5 + 182 / 2, y - 29); - GLRenderer.popFrame(); } @Override public void renderPreview(Gui gui, Layout layout, int xSizeScreen, int ySizeScreen) { int x = layout.getComponentX(this, xSizeScreen); int y = layout.getComponentY(this, ySizeScreen); + boolean isVertical = this.isVertical(); - // Setup hotbar texture - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color - - // Render hotbar - gui.drawGuiIcon(x + 5, y, 182, 22, TextureRegistry.getTexture("minecraft:gui/hud/hotbar")); - - // Render hotbar switcher and dots - final int selectedHotbar = 3; - IconCoordinate coordinate = TextureRegistry.getTexture("minecraft:gui/hud/hotbar_selector" + selectedHotbar); - gui.drawGuiIcon(x, y, 6, 22, coordinate); - - // Render selector - gui.drawGuiIcon((x + 4), y - 1, 24, 24, TextureRegistry.getTexture("minecraft:gui/hud/hotbar_selection")); + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); + // Draw backgrounds + drawOrientedBackgrounds(gui, x, y, 3, 0, false, isVertical); // Setup items GLRenderer.enableState(State.DEPTH_TEST); GLRenderer.enableState(State.BLEND); Lighting.enableInventoryLight(); - // Render hotbar items - GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); for (int itemIndex = 0; itemIndex < ContainerInventory.HOTBAR_SIZE; itemIndex++) { - int itemX = x + 8 + itemIndex * 20; - int itemY = y + 3; + int itemX = isVertical ? (x + 3) : (x + 8 + itemIndex * 20); + int itemY = isVertical ? (y + 8 + itemIndex * 20) : (y + 3); renderItem(mc, PREVIEW_ITEMS[itemIndex], itemX, itemY); } Lighting.disable(); } + private void drawOrientedBackgrounds(Gui gui, int x, int y, int selectedHotbar, int currentSlotIndex, boolean isLocked, boolean isVertical) { + IconCoordinate selectorDots = TextureRegistry.getTexture("minecraft:gui/hud/hotbar_selector" + selectedHotbar); + String selTexture = "minecraft:gui/hud/hotbar_selection" + (isLocked ? "_locked" : ""); + + //Uses OpenGL matrix rotation to draw the horizontal hotbar vertically + if (isVertical) { + GLRenderer.pushFrame(); + GLRenderer.modelM4f().translate(x + 22, y, 0); + GLRenderer.modelM4f().rotate((float) Math.toRadians(90), 0.0f, 0.0f, 1.0f); + gui.drawGuiIcon(5, 0, 182, 22, TextureRegistry.getTexture("minecraft:gui/hud/hotbar")); + gui.drawGuiIcon(0, 0, 6, 22, selectorDots); + gui.drawGuiIcon(4 + currentSlotIndex * 20, -1, 24, 24, TextureRegistry.getTexture(selTexture)); + GLRenderer.popFrame(); + } else { + gui.drawGuiIcon(x + 5, y, 182, 22, TextureRegistry.getTexture("minecraft:gui/hud/hotbar")); + gui.drawGuiIcon(x, y, 6, 22, selectorDots); + gui.drawGuiIcon((x + 4) + currentSlotIndex * 20, y - 1, 24, 24, TextureRegistry.getTexture(selTexture)); + } + } + private void renderInventorySlot(Minecraft mc, int itemIndex, int x, int y, float partialTick) { ItemStack itemstack = mc.thePlayer.inventory.mainInventory[itemIndex]; if (itemstack == null) { @@ -193,7 +234,6 @@ public class HudComponentHotbar GLRenderer.modelM4f().scale(1.0F / f2, (f2 + 1.0F) / 2.0F, 1.0F); GLRenderer.modelM4f().translate(-(x + 8), -(y + 12), 0.0F); } -// itemModel.renderItemIntoGui(GLRenderer.getTessellator(), mc.font, mc.textureManager, itemstack, x, y, 1.0f); itemModel.renderGui(GLRenderer.getTessellator(), null, itemstack, x, y, LightIndexHelper.lightIndex2i(15, 15), partialTick); if (animProgress > 0.0F) { GLRenderer.popFrame(); @@ -203,8 +243,7 @@ public class HudComponentHotbar private void renderItem(Minecraft mc, ItemStack itemStack, int x, int y) { ItemModel itemModel = ItemModelDispatcher.getInstance().getDispatch(itemStack.getItem()); -// itemModel.renderItemIntoGui(GLRenderer.getTessellator(), mc.font, mc.textureManager, itemStack, x, y, 1.0f); itemModel.renderGui(GLRenderer.getTessellator(), null, itemStack, x, y, LightIndexHelper.lightIndex2i(15, 15), 1f); itemModel.renderItemOverlayIntoGUI(GLRenderer.getTessellator(), mc.font, mc.textureManager, itemStack, x, y, null, 1.0f); } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentInfoOverlay.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentInfoOverlay.java index 6732801a6..61f3dbabf 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentInfoOverlay.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentInfoOverlay.java @@ -3,8 +3,6 @@ package net.minecraft.client.gui.hud.component; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.hud.HudIngame; import net.minecraft.client.gui.hud.component.layout.Layout; -import net.minecraft.client.gui.hud.component.layout.LayoutAbsolute; -import net.minecraft.client.gui.hud.component.layout.LayoutSnap; import net.minecraft.client.option.GameSettings; import net.minecraft.core.Global; import net.minecraft.core.item.ItemStack; @@ -20,12 +18,17 @@ import net.minecraft.core.world.season.Seasons; import net.minecraft.core.world.weather.Weather; import net.minecraft.core.world.weather.Weathers; +import java.util.ArrayList; +import java.util.List; + import static net.minecraft.core.util.helper.Utils.floor10; -public class HudComponentInfoOverlay - extends HudComponentMovable { +public class HudComponentInfoOverlay extends HudComponentMovable { + + private record RenderLine(String text, int color) {} + public HudComponentInfoOverlay(String key, Layout layout) { - super(key, 130, 112, layout); + super(key, 175, 150, layout); } @Override @@ -33,13 +36,19 @@ public class HudComponentInfoOverlay return GameSettings.IMMERSIVE_MODE.drawOverlays() && !GameSettings.SHOW_DEBUG_SCREEN.value; } - private void drawString(String string, int x, int y, int argb, boolean rightAligned) { - int xOffset = -2; - if (rightAligned) { - xOffset = mc.font.stringWidth(string) + 2 - this.getXSize(); - } + private void drawAlignedString(String text, int boxX, int boxY, int boxWidth, int argb) { + int textWidth = mc.font.stringWidth(text); + float xMult = GameSettings.HORIZONTAL_INFO_TEXT_ALIGNMENT.value.multiplier; + int padding = 2; + int renderX = boxX + padding + (int) ((boxWidth - (padding * 2) - textWidth) * xMult); + mc.font.render(text, renderX, boxY).setShadow().setColor(argb).call(); + } - mc.font.render(string, x - xOffset, y).setShadow().setColor(argb).call(); + private int getPreviewColor(int baseColor, boolean isEnabled) { + if (isEnabled) { + return baseColor; + } + return (baseColor & 0x00FFFFFF) | 0x55000000; } @Override @@ -47,19 +56,6 @@ public class HudComponentInfoOverlay int x = this.getLayout().getComponentX(this, xSizeScreen); int y = this.getLayout().getComponentY(this, ySizeScreen); - boolean rightAligned = false; - if (this.getLayout() instanceof LayoutAbsolute layout) { - final ComponentAnchor anchor = layout.getAnchor(); - if (anchor == ComponentAnchor.TOP_RIGHT || anchor == ComponentAnchor.CENTER_RIGHT || anchor == ComponentAnchor.BOTTOM_RIGHT) { - rightAligned = true; - } - } else if (this.getLayout() instanceof LayoutSnap layout) { - final ComponentAnchor anchor = layout.getAnchor(); - if (anchor == ComponentAnchor.TOP_RIGHT || anchor == ComponentAnchor.CENTER_RIGHT || anchor == ComponentAnchor.BOTTOM_RIGHT) { - rightAligned = true; - } - } - boolean clock = false; boolean compass = false; boolean rotaryCalendar = false; @@ -72,84 +68,78 @@ public class HudComponentInfoOverlay for (int iinv = 0; iinv < mc.thePlayer.inventory.getContainerSize(); iinv++) { ItemStack item = mc.thePlayer.inventory.getItem(iinv); if (item != null) { - if (item.itemID == Items.TOOL_CLOCK.id) { - clock = true; - } - if (item.itemID == Items.TOOL_COMPASS.id) { - compass = true; - } - if (item.itemID == Items.TOOL_CALENDAR.id) { - rotaryCalendar = true; - } + if (item.itemID == Items.TOOL_CLOCK.id) clock = true; + if (item.itemID == Items.TOOL_COMPASS.id) compass = true; + if (item.itemID == Items.TOOL_CALENDAR.id) rotaryCalendar = true; } } } - int tsp = 2; - int line = 0; - int lineHeight = 10; + List lines = new ArrayList<>(); if (GameSettings.VERSION_IN_OVERLAY.value) { - int color; - if (GameSettings.OVERLAY_MODE.value == 2) { - color = 0xFFFFFF60; - } else { - color = 0xFFFFFFFF; - } - drawString("Better than Adventure! " + TextFormatting.WHITE + Global.VERSION, x, y + tsp + lineHeight * line++, color, rightAligned); + int color = (GameSettings.OVERLAY_MODE.value == 2) ? 0xFFFFFF60 : 0xFFFFFFFF; + lines.add(new RenderLine("Better than Adventure! " + TextFormatting.WHITE + Global.VERSION, color)); } + if (GameSettings.FPS_IN_OVERLAY.value) { - drawString(mc.lingDebugFPS, x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine(mc.lingDebugFPS, 0xFFFFFFFF)); } + if (compass) { - if (GameSettings.OVERLAY_SHOW_COORDS.value) { + if (GameSettings.COORDS_IN_OVERLAY.value) { if (GameSettings.OVERLAY_MODE.value == 0) { - drawString("x: " + floor10(mc.thePlayer.x) + " y: " + floor10(mc.thePlayer.y) + " z: " + floor10(mc.thePlayer.z), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine("x: " + floor10(mc.thePlayer.x) + " y: " + floor10(mc.thePlayer.y) + " z: " + floor10(mc.thePlayer.z), 0xFFFFFFFF)); } if (GameSettings.OVERLAY_MODE.value == 1) { - drawString("x: " + floor10(mc.thePlayer.x), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - drawString("y: " + floor10(mc.thePlayer.y), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - drawString("z: " + floor10(mc.thePlayer.z), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine("x: " + floor10(mc.thePlayer.x), 0xFFFFFFFF)); + lines.add(new RenderLine("y: " + floor10(mc.thePlayer.y), 0xFFFFFFFF)); + lines.add(new RenderLine("z: " + floor10(mc.thePlayer.z), 0xFFFFFFFF)); } if (GameSettings.OVERLAY_MODE.value == 2) { - drawString("x: " + floor10(mc.thePlayer.x), x, y + tsp + lineHeight * line++, 0xFFFF8080, rightAligned); - drawString("y: " + floor10(mc.thePlayer.y), x, y + tsp + lineHeight * line++, 0xFF80FF80, rightAligned); - drawString("z: " + floor10(mc.thePlayer.z), x, y + tsp + lineHeight * line++, 0xFF8080FF, rightAligned); + lines.add(new RenderLine("x: " + floor10(mc.thePlayer.x), 0xFFFF8080)); + lines.add(new RenderLine("y: " + floor10(mc.thePlayer.y), 0xFF80FF80)); + lines.add(new RenderLine("z: " + floor10(mc.thePlayer.z), 0xFF8080FF)); } } - if (GameSettings.OVERLAY_SHOW_DIRECTION.value) { - drawString(I18n.getInstance().translateKey(HudIngame.getFacingDirection(mc.thePlayer).getTranslationKey()), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); + if (GameSettings.DIRECTION_IN_OVERLAY.value) { + lines.add(new RenderLine(I18n.getInstance().translateKey(HudIngame.getFacingDirection(mc.thePlayer).getTranslationKey()), 0xFFFFFFFF)); } } + if (clock) { - if (GameSettings.OVERLAY_SHOW_TIME.value) { + if (GameSettings.TIME_IN_OVERLAY.value) { + int color = (GameSettings.OVERLAY_MODE.value == 2) ? 0xFFFFFF80 : 0xFFFFFFFF; if (GameSettings.OVERLAY_MODE.value == 0) { - drawString(String.format("%s %s %d", HudIngame.getTimeString(mc), I18n.getInstance().translateKey("unit.day"), mc.currentWorld.getWorldTime() / Global.DAY_LENGTH_TICKS), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFFFF80 : 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine(String.format("%s %s %d", HudIngame.getTimeString(mc), I18n.getInstance().translateKey("unit.day"), mc.currentWorld.getWorldTime() / Global.DAY_LENGTH_TICKS), color)); } if (GameSettings.OVERLAY_MODE.value > 0) { - drawString(HudIngame.getTimeString(mc), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFFFF80 : 0xFFFFFFFF, rightAligned); - drawString(String.format("%s %d", I18n.getInstance().translateKey("unit.day"), mc.currentWorld.getWorldTime() / Global.DAY_LENGTH_TICKS), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFFFF80 : 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine(HudIngame.getTimeString(mc), color)); + lines.add(new RenderLine(String.format("%s %d", I18n.getInstance().translateKey("unit.day"), mc.currentWorld.getWorldTime() / Global.DAY_LENGTH_TICKS), color)); } } } + if (rotaryCalendar) { - if (GameSettings.OVERLAY_SHOW_SEASON.value) { + if (GameSettings.SEASON_IN_OVERLAY.value) { Season season = mc.currentWorld.getSeasonManager().getCurrentSeason(); if (season != null) { - drawString(season.getTranslatedName(), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFF80FFFF : 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine(season.getTranslatedName(), GameSettings.OVERLAY_MODE.value == 2 ? 0xFF80FFFF : 0xFFFFFFFF)); } } - if (GameSettings.OVERLAY_SHOW_WEATHER.value) { + if (GameSettings.WEATHER_IN_OVERLAY.value) { Weather weather = mc.currentWorld.getCurrentWeather(); if (weather != null && weather != mc.currentWorld.getWorldType().getDefaultWeather()) { - drawString(I18n.getInstance().translateKey(weather.getNameLanguageKey()), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFF80FF : 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine(I18n.getInstance().translateKey(weather.getNameLanguageKey()), GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFF80FF : 0xFFFFFFFF)); } } - if (GameSettings.OVERLAY_SHOW_BIOME.value) { + if (GameSettings.BIOME_IN_OVERLAY.value) { String key = mc.currentWorld.getBlockBiome(new TilePos(mc.thePlayer)).translationKey; - drawString(I18n.getInstance().translateKey(key), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); + lines.add(new RenderLine(I18n.getInstance().translateKey(key), 0xFFFFFFFF)); } } + + drawLines(lines, x, y); } @Override @@ -157,76 +147,77 @@ public class HudComponentInfoOverlay int x = this.getLayout().getComponentX(this, xSizeScreen); int y = this.getLayout().getComponentY(this, ySizeScreen); - boolean rightAligned = false; - if (layout instanceof LayoutAbsolute) { - final LayoutAbsolute l = (LayoutAbsolute) this.getLayout(); - final ComponentAnchor anchor = l.getAnchor(); - if (anchor == ComponentAnchor.TOP_RIGHT || anchor == ComponentAnchor.CENTER_RIGHT || anchor == ComponentAnchor.BOTTOM_RIGHT) { - rightAligned = true; - } - } else if (layout instanceof LayoutSnap) { - final LayoutSnap l = (LayoutSnap) this.getLayout(); - final ComponentAnchor anchor = l.getAnchor(); - if (anchor == ComponentAnchor.TOP_RIGHT || anchor == ComponentAnchor.CENTER_RIGHT || anchor == ComponentAnchor.BOTTOM_RIGHT) { - rightAligned = true; - } - } + List lines = new ArrayList<>(); - int tsp = 2; - int line = 0; - int lineHeight = 10; + int versionBaseColor = (GameSettings.OVERLAY_MODE.value == 2) ? 0xFFFFFF60 : 0xFFFFFFFF; + boolean versionEnabled = GameSettings.VERSION_IN_OVERLAY.value; - { // FPS - drawString("60 fps", x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - } - { // Compass - { - final double px = 372.853; - final double py = 64.355; - final double pz = 38472.333; + String versionText = "Better than Adventure! " + (versionEnabled ? TextFormatting.WHITE : "") + Global.VERSION; + lines.add(new RenderLine(versionText, getPreviewColor(versionBaseColor, versionEnabled))); - if (GameSettings.OVERLAY_MODE.value == 0) { - drawString("x: " + floor10(px) + " y: " + floor10(py) + " z: " + floor10(pz), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - } - if (GameSettings.OVERLAY_MODE.value == 1) { - drawString("x: " + floor10(px), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - drawString("y: " + floor10(py), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - drawString("z: " + floor10(pz), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - } - if (GameSettings.OVERLAY_MODE.value == 2) { - drawString("x: " + floor10(px), x, y + tsp + lineHeight * line++, 0xFFFF8080, rightAligned); - drawString("y: " + floor10(py), x, y + tsp + lineHeight * line++, 0xFF80FF80, rightAligned); - drawString("z: " + floor10(pz), x, y + tsp + lineHeight * line++, 0xFF8080FF, rightAligned); - } - } - { - drawString(I18n.getInstance().translateKey(Direction.NORTH.getTranslationKey()), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - } + boolean fpsEnabled = GameSettings.FPS_IN_OVERLAY.value; + lines.add(new RenderLine("127 fps", getPreviewColor(0xFFFFFFFF, fpsEnabled))); + + final double px = 372.853; + final double py = 64.355; + final double pz = 38472.333; + boolean coordsEnabled = GameSettings.COORDS_IN_OVERLAY.value; + + if (GameSettings.OVERLAY_MODE.value == 0) { + lines.add(new RenderLine("x: " + floor10(px) + " y: " + floor10(py) + " z: " + floor10(pz), getPreviewColor(0xFFFFFFFF, coordsEnabled))); + } else if (GameSettings.OVERLAY_MODE.value == 1) { + lines.add(new RenderLine("x: " + floor10(px), getPreviewColor(0xFFFFFFFF, coordsEnabled))); + lines.add(new RenderLine("y: " + floor10(py), getPreviewColor(0xFFFFFFFF, coordsEnabled))); + lines.add(new RenderLine("z: " + floor10(pz), getPreviewColor(0xFFFFFFFF, coordsEnabled))); + } else if (GameSettings.OVERLAY_MODE.value == 2) { + lines.add(new RenderLine("x: " + floor10(px), getPreviewColor(0xFFFF8080, coordsEnabled))); + lines.add(new RenderLine("y: " + floor10(py), getPreviewColor(0xFF80FF80, coordsEnabled))); + lines.add(new RenderLine("z: " + floor10(pz), getPreviewColor(0xFF8080FF, coordsEnabled))); } - { - { - if (GameSettings.OVERLAY_MODE.value == 0) { - drawString(String.format("%s %s %d", "8:32", I18n.getInstance().translateKey("unit.day"), 500), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFFFF80 : 0xFFFFFFFF, rightAligned); - } - if (GameSettings.OVERLAY_MODE.value > 0) { - drawString("8:32", x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFFFF80 : 0xFFFFFFFF, rightAligned); - drawString(String.format("%s %d", I18n.getInstance().translateKey("unit.day"), 500), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFFFF80 : 0xFFFFFFFF, rightAligned); - } - } + + boolean dirEnabled = GameSettings.DIRECTION_IN_OVERLAY.value; + lines.add(new RenderLine(I18n.getInstance().translateKey(Direction.NORTH.getTranslationKey()), getPreviewColor(0xFFFFFFFF, dirEnabled))); + + int clockColor = (GameSettings.OVERLAY_MODE.value == 2) ? 0xFFFFFF80 : 0xFFFFFFFF; + boolean timeEnabled = GameSettings.TIME_IN_OVERLAY.value; + + if (GameSettings.OVERLAY_MODE.value == 0) { + lines.add(new RenderLine(String.format("%s %s %d", "8:32", I18n.getInstance().translateKey("unit.day"), 500), getPreviewColor(clockColor, timeEnabled))); + } else if (GameSettings.OVERLAY_MODE.value > 0) { + lines.add(new RenderLine("8:32", getPreviewColor(clockColor, timeEnabled))); + lines.add(new RenderLine(String.format("%s %d", I18n.getInstance().translateKey("unit.day"), 500), getPreviewColor(clockColor, timeEnabled))); } - { - { - Season season = Seasons.OVERWORLD_SUMMER; - drawString(season.getTranslatedName(), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFF80FFFF : 0xFFFFFFFF, rightAligned); - } - { - Weather weather = Weathers.OVERWORLD_FOG; - drawString(I18n.getInstance().translateKey(weather.getNameLanguageKey()), x, y + tsp + lineHeight * line++, GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFF80FF : 0xFFFFFFFF, rightAligned); - } - { - String key = Biomes.OVERWORLD_GRASSLANDS.translationKey; - drawString(I18n.getInstance().translateKey(key), x, y + tsp + lineHeight * line++, 0xFFFFFFFF, rightAligned); - } + + Season season = Seasons.OVERWORLD_SUMMER; + boolean seasonEnabled = GameSettings.SEASON_IN_OVERLAY.value; + lines.add(new RenderLine(season.getTranslatedName(), getPreviewColor(GameSettings.OVERLAY_MODE.value == 2 ? 0xFF80FFFF : 0xFFFFFFFF, seasonEnabled))); + + Weather weather = Weathers.OVERWORLD_FOG; + boolean weatherEnabled = GameSettings.WEATHER_IN_OVERLAY.value; + lines.add(new RenderLine(I18n.getInstance().translateKey(weather.getNameLanguageKey()), getPreviewColor(GameSettings.OVERLAY_MODE.value == 2 ? 0xFFFF80FF : 0xFFFFFFFF, weatherEnabled))); + + String biomeKey = Biomes.OVERWORLD_GRASSLANDS.translationKey; + boolean biomeEnabled = GameSettings.BIOME_IN_OVERLAY.value; + lines.add(new RenderLine(I18n.getInstance().translateKey(biomeKey), getPreviewColor(0xFFFFFFFF, biomeEnabled))); + + drawLines(lines, x, y); + } + + private void drawLines(List lines, int x, int y) { + if (lines.isEmpty()) return; + + int lineHeight = 10; + int totalHeight = lines.size() * lineHeight; + + float yMult = GameSettings.VERTICAL_INFO_TEXT_ALIGNMENT.value.multiplier; + + int padding = 2; + int startY = y + padding + (int) ((this.getDisplayedYSize() - (padding * 2) - totalHeight) * yMult); + + for (int i = 0; i < lines.size(); i++) { + RenderLine line = lines.get(i); + int currentY = startY + (i * lineHeight); + drawAlignedString(line.text, x, currentY, this.getDisplayedXSize(), line.color); } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentOxygenBar.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentOxygenBar.java index 473b48cf0..e572bb875 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentOxygenBar.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentOxygenBar.java @@ -10,21 +10,58 @@ import net.minecraft.client.render.texture.stitcher.IconCoordinate; import net.minecraft.client.render.texture.stitcher.TextureRegistry; import net.minecraft.core.block.material.Materials; - -public class HudComponentOxygenBar - extends HudComponentMovable { +public class HudComponentOxygenBar extends HudComponentMovable { private final IconCoordinate air; private final IconCoordinate air_pop; public HudComponentOxygenBar(String key, Layout layout) { - super(key, 81, 10, layout); + super(key, 81, 9, layout); this.air = TextureRegistry.getTexture("minecraft:gui/hud/air"); this.air_pop = TextureRegistry.getTexture("minecraft:gui/hud/air_pop"); } + private boolean isVertical() { + return GameSettings.VERTICAL_OXYGEN_BAR.value; + } + + private boolean isFlipped() { + return GameSettings.FLIP_OXYGEN_BAR.value; + } + + @Override + public int getDisplayedXSize() { + return this.isVertical() ? super.getDisplayedYSize() : super.getDisplayedXSize(); + } + + @Override + public int getDisplayedYSize() { + return this.isVertical() ? super.getDisplayedXSize() : super.getDisplayedYSize(); + } + + @Override + public int getTrueXSize() { + return this.isVertical() ? super.getTrueYSize() : super.getTrueXSize(); + } + + @Override + public int getTrueYSize() { + return this.isVertical() ? super.getTrueXSize() : super.getTrueYSize(); + } + @Override public boolean isVisible() { - return GameSettings.IMMERSIVE_MODE.drawHotbar() && !mc.thePlayer.getGamemode().hasInvulnerablePlayer() && mc.thePlayer.isUnderLiquid(Materials.WATER); + if (mc.thePlayer == null) { + return GameSettings.IMMERSIVE_MODE.drawHotbar(); + } + return GameSettings.IMMERSIVE_MODE.drawHotbar() && + !mc.thePlayer.getGamemode().hasInvulnerablePlayer() && + mc.thePlayer.isUnderLiquid(Materials.WATER) && + !GameSettings.HIDE_OXYGEN_BAR.value; + } + + @Override + public boolean isPreviewTranslucent() { + return GameSettings.HIDE_OXYGEN_BAR.value; } @Override @@ -36,13 +73,28 @@ public class HudComponentOxygenBar GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color GLRenderer.enableState(State.BLEND); + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + int numBubbles = (int) Math.ceil(((double) (mc.thePlayer.airSupply - 2) * 10D) / 300D); int numPops = (int) Math.ceil(((double) mc.thePlayer.airSupply * 10D) / 300D) - numBubbles; + for (int i = 0; i < numBubbles + numPops; i++) { + int xIcon; + int yIcon; + + if (isVertical) { + xIcon = x; + yIcon = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + } else { + xIcon = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yIcon = y; + } + if (i < numBubbles) { - hud.drawGuiIcon(x + i * 8, y, 9, 9, this.air); + hud.drawGuiIcon(xIcon, yIcon, 9, 9, this.air); } else { - hud.drawGuiIcon(x + i * 8, y, 9, 9, this.air_pop); + hud.drawGuiIcon(xIcon, yIcon, 9, 9, this.air_pop); } } } @@ -54,16 +106,32 @@ public class HudComponentOxygenBar // Setup rendering GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + renderTranslucency(); GLRenderer.enableState(State.BLEND); + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + int numBubbles = 5; int numPops = 6 - numBubbles; + for (int i = 0; i < numBubbles + numPops; i++) { + int xIcon; + int yIcon; + + if (isVertical) { + xIcon = x; + yIcon = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + } else { + xIcon = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yIcon = y; + } + if (i < numBubbles) { - gui.drawGuiIcon(x + i * 8, y, 9, 9, this.air); + gui.drawGuiIcon(xIcon, yIcon, 9, 9, this.air); } else { - gui.drawGuiIcon(x + i * 8, y, 9, 9, this.air_pop); + gui.drawGuiIcon(xIcon, yIcon, 9, 9, this.air_pop); } } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentRotationLock.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentRotationLock.java index 5a3c03019..8e8e5f8b9 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentRotationLock.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentRotationLock.java @@ -18,6 +18,9 @@ public class HudComponentRotationLock @Override public boolean isVisible() { + if (mc.thePlayer == null) { + return GameSettings.IMMERSIVE_MODE.drawOverlays(); + } return mc.thePlayer.rotationLock != null && mc.thePlayer.rotationLock != Direction.NONE && GameSettings.IMMERSIVE_MODE.drawOverlays(); } diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentSubtitles.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentSubtitles.java index db97755eb..37d25ac4d 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentSubtitles.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentSubtitles.java @@ -46,8 +46,8 @@ public class HudComponentSubtitles extends HudComponentMovable { { int x = this.getLayout().getComponentX(this, xSizeScreen); int y = this.getLayout().getComponentY(this, ySizeScreen); - int width = getXSize(); - int height = getYSize(); + int width = getDisplayedXSize(); + int height = getDisplayedYSize(); int xRight = x + width; int yBottom = y + height; int messagesToShow = height/10; diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentVehicleHealthBar.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentVehicleHealthBar.java index f374690da..879ae2f8f 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentVehicleHealthBar.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponentVehicleHealthBar.java @@ -12,17 +12,52 @@ import net.minecraft.core.util.helper.MathHelper; import java.util.Random; -public class HudComponentVehicleHealthBar - extends HudComponentMovable { +public class HudComponentVehicleHealthBar extends HudComponentMovable { private final Random random = new Random(); public HudComponentVehicleHealthBar(String key, Layout layout) { - super(key, 81, 10, layout); + super(key, 81, 9, layout); + } + + private boolean isVertical() { + return GameSettings.VERTICAL_VEHICLE_BAR.value; + } + + private boolean isFlipped() { + return GameSettings.FLIP_VEHICLE_BAR.value; + } + + @Override + public int getDisplayedXSize() { + return this.isVertical() ? super.getDisplayedYSize() : super.getDisplayedXSize(); + } + + @Override + public int getDisplayedYSize() { + return this.isVertical() ? super.getDisplayedXSize() : super.getDisplayedYSize(); + } + + @Override + public int getTrueXSize() { + return this.isVertical() ? super.getTrueYSize() : super.getTrueXSize(); + } + + @Override + public int getTrueYSize() { + return this.isVertical() ? super.getTrueXSize() : super.getTrueYSize(); } @Override public boolean isVisible() { - return mc.thePlayer.vehicle instanceof Mob && GameSettings.IMMERSIVE_MODE.drawHotbar(); + if (mc.thePlayer == null) { + return GameSettings.IMMERSIVE_MODE.drawHotbar(); + } + return mc.thePlayer.vehicle instanceof Mob && GameSettings.IMMERSIVE_MODE.drawHotbar() && !GameSettings.HIDE_VEHICLE_BAR.value; + } + + @Override + public boolean isPreviewTranslucent() { + return GameSettings.HIDE_VEHICLE_BAR.value; } @Override @@ -43,36 +78,61 @@ public class HudComponentVehicleHealthBar int prevHealth = mobVehicle.prevHealth; this.random.setSeed(hud.updateCounter * 0x4c627L); + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + + String halfSuffix = ""; + if (isVertical) { + halfSuffix = isFlipped ? "_vertical_flipped" : "_vertical"; + } else if (isFlipped) { + halfSuffix = "_flipped"; + } + int hearts = MathHelper.ceil(mobVehicle.getMaxHealth() / 2f); + String basePath = "minecraft:gui/hud/heart/vehicle/pig/"; + for (int i = 0; i < hearts; i++) { int heartOffset = 0; if (heartsFlash) { heartOffset = 1; } - int xHeart = (x + 9 * 8) - i * 8; - int yHeart = y; - if (health <= 4) { - yHeart += this.random.nextInt(2); + + int xHeart; + int yHeart; + + if (isVertical) { + xHeart = x; + yHeart = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + if (health <= 4) { + xHeart += this.random.nextInt(2); // Shake horizontally + } + } else { + xHeart = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yHeart = y; + if (health <= 4) { + yHeart += this.random.nextInt(2); // Shake vertically + } } - hud.drawGuiIcon(xHeart, yHeart, 9, 9, heartOffset == 0 ? TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/container") : TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/container_blinking")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, heartOffset == 0 ? TextureRegistry.getTexture(basePath + "container") : TextureRegistry.getTexture(basePath + "container_blinking")); + if (heartsFlash) { if (i * 2 + 1 < prevHealth) { // Half flash heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/full_blinking")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "full_blinking")); } if (i * 2 + 1 == prevHealth) { // Full flash heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/half_blinking")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "half_blinking" + halfSuffix)); } } if (i * 2 + 1 < health) { // Full heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/full")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "full")); } if (i * 2 + 1 == health) { // Half heart icon - hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/half")); + hud.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "half" + halfSuffix)); } } } @@ -85,20 +145,44 @@ public class HudComponentVehicleHealthBar // Setup rendering GLRenderer.setColor4f(1.0f, 1.0f, 1.0f, 1.0f); // Reset color + renderTranslucency(); GLRenderer.enableState(State.BLEND); int health = 11; + boolean isVertical = this.isVertical(); + boolean isFlipped = this.isFlipped(); + + String halfSuffix = ""; + if (isVertical) { + halfSuffix = isFlipped ? "_vertical_flipped" : "_vertical"; + } else if (isFlipped) { + halfSuffix = "_flipped"; + } + + String basePath = "minecraft:gui/hud/heart/vehicle/pig/"; + for (int i = 0; i < 10; i++) { - int xHeart = (x + 9 * 8) - i * 8; - gui.drawGuiIcon(xHeart, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/container")); + int xHeart; + int yHeart; + + if (isVertical) { + xHeart = x; + yHeart = isFlipped ? (y + i * 8) : (y + (9 - i) * 8); + } else { + xHeart = isFlipped ? (x + (9 - i) * 8) : (x + i * 8); + yHeart = y; + } + + gui.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "container")); + if (i * 2 + 1 < health) { // Full heart icon - gui.drawGuiIcon(xHeart, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/full")); + gui.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "full")); } if (i * 2 + 1 == health) { // Half heart icon - gui.drawGuiIcon(xHeart, y, 9, 9, TextureRegistry.getTexture("minecraft:gui/hud/heart/pig/half")); + gui.drawGuiIcon(xHeart, yHeart, 9, 9, TextureRegistry.getTexture(basePath + "half" + halfSuffix)); } } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponents.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponents.java index 4edc6090a..6dbdda565 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponents.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/HudComponents.java @@ -3,6 +3,11 @@ package net.minecraft.client.gui.hud.component; import com.mojang.logging.LogUtils; import net.minecraft.client.gui.hud.component.layout.LayoutAbsolute; import net.minecraft.client.gui.hud.component.layout.LayoutSnap; +import net.minecraft.client.gui.options.components.BooleanOptionComponent; +import net.minecraft.client.gui.options.components.KeyBindingComponent; +import net.minecraft.client.gui.options.components.ToggleableOptionComponent; +import net.minecraft.client.option.GameSettings; +import net.minecraft.core.enums.HumanArmorShape; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; @@ -16,35 +21,114 @@ public class HudComponents { public static String DEFAULT_LAYOUT = null; public static final @Nullable HudComponents INSTANCE = new HudComponents(); - public static final @NotNull HudComponent HOTBAR = register(new HudComponentHotbar("hotbar", new LayoutAbsolute(0.5f, 1.0f, ComponentAnchor.BOTTOM_CENTER))); - public static final @NotNull HudComponent CROSSHAIR = register(new HudComponentCrosshair("crosshair", new LayoutAbsolute(0.5f, 0.5f, ComponentAnchor.CENTER))); - public static final @NotNull HudComponent HEALTH_BAR = register(new HudComponentHealthBar("health_bar", new LayoutSnap(HOTBAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT))); - public static final @NotNull HudComponent ARMOR_BAR = register(new HudComponentArmorBar("armor_bar", new LayoutSnap(HOTBAR, ComponentAnchor.TOP_RIGHT, ComponentAnchor.BOTTOM_RIGHT))); - public static final @NotNull HudComponent VEHICLE_BAR = register(new HudComponentVehicleHealthBar("vehicle_bar", new LayoutSnap(ARMOR_BAR, ComponentAnchor.TOP_RIGHT, ComponentAnchor.BOTTOM_RIGHT))); - public static final @NotNull HudComponent OXYGEN_BAR = register(new HudComponentOxygenBar("oxygen_bar", new LayoutSnap(HEALTH_BAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT))); - public static final @NotNull HudComponent FIRE_BAR = register(new HudComponentFireBar("fire_bar", new LayoutSnap(OXYGEN_BAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT))); - public static final @NotNull HudComponent ROTATION_LOCK = register(new HudComponentRotationLock("rotation_lock", new LayoutSnap(CROSSHAIR, ComponentAnchor.CENTER_RIGHT, ComponentAnchor.CENTER_LEFT))); - public static final @NotNull HudComponent SUBTITLES = register(new HudComponentSubtitles("subtitles_box", 100, 50, new LayoutAbsolute(1.0f, 0.75f, ComponentAnchor.BOTTOM_RIGHT))); - public static final @NotNull HudComponent LOG = register(new HudComponentLog("log", new LayoutAbsolute(1.0f, 0.0f, ComponentAnchor.TOP_RIGHT))); - public static final @NotNull HudComponent ARMOR_DURABILITY = register(new HudComponentArmorDurability("armor_durability", new LayoutAbsolute(0.0f, 1.0f, ComponentAnchor.BOTTOM_LEFT))); - public static final @NotNull HudComponent HELD_ITEM_COUNT = register(new HudComponentHeldItemCount("held_item_count", new LayoutSnap(HOTBAR, ComponentAnchor.CENTER_RIGHT, ComponentAnchor.CENTER_LEFT))); - public static final @NotNull HudComponent INFO_OVERLAY = register(new HudComponentInfoOverlay("info_overlay", new LayoutAbsolute(0.0f, 0.0f, ComponentAnchor.TOP_LEFT))); + // Absolute components + public static final @NotNull HudComponentHotbar HOTBAR = register( + new HudComponentHotbar("hotbar", new LayoutAbsolute(0.5f, 1.0f, ComponentAnchor.BOTTOM_CENTER, 0, -2)) + .addAttachedOption(GameSettings.VERTICAL_HOT_BAR, () -> new BooleanOptionComponent(GameSettings.VERTICAL_HOT_BAR)) + ); + public static final @NotNull HudComponentCrosshair CROSSHAIR = register( + new HudComponentCrosshair("crosshair", new LayoutAbsolute(0.5f, 0.5f, ComponentAnchor.CENTER)) + ); + public static final @NotNull HudComponentSubtitles SUBTITLES = register( + new HudComponentSubtitles("subtitles_box", 100, 50, new LayoutAbsolute(1.0f, 0.75f, ComponentAnchor.BOTTOM_RIGHT)) + ); + public static final @NotNull HudComponentLog LOG = register( + new HudComponentLog("log", new LayoutAbsolute(1.0f, 0.0f, ComponentAnchor.TOP_RIGHT)) + ); - public static HudComponent register(HudComponent component) { + // public static final @NotNull HudComponentArmorDurability ARMOR_DURABILITY = register(new HudComponentArmorDurability("armor_durability", new LayoutAbsolute(0.0f, 1.0f, ComponentAnchor.BOTTOM_LEFT))); + + public static final @NotNull HudComponentInfoOverlay INFO_OVERLAY = register( + new HudComponentInfoOverlay("info_overlay", new LayoutAbsolute(0.0f, 0.0f, ComponentAnchor.TOP_LEFT)) + .addAttachedOption(GameSettings.HORIZONTAL_INFO_TEXT_ALIGNMENT, () -> new ToggleableOptionComponent<>(GameSettings.HORIZONTAL_INFO_TEXT_ALIGNMENT)) + .addAttachedOption(GameSettings.VERTICAL_INFO_TEXT_ALIGNMENT, () -> new ToggleableOptionComponent<>(GameSettings.VERTICAL_INFO_TEXT_ALIGNMENT)) + .addAttachedOption(GameSettings.VERSION_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.VERSION_IN_OVERLAY)) + .addAttachedOption(GameSettings.FPS_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.FPS_IN_OVERLAY)) + .addAttachedOption(GameSettings.COORDS_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.COORDS_IN_OVERLAY)) + .addAttachedOption(GameSettings.DIRECTION_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.DIRECTION_IN_OVERLAY)) + .addAttachedOption(GameSettings.TIME_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.TIME_IN_OVERLAY)) + .addAttachedOption(GameSettings.SEASON_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.SEASON_IN_OVERLAY)) + .addAttachedOption(GameSettings.WEATHER_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.WEATHER_IN_OVERLAY)) + .addAttachedOption(GameSettings.BIOME_IN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.BIOME_IN_OVERLAY)) + .addAttachedKeyBinding(GameSettings.KEY_TOGGLE_INFO_OVERLAY, () -> new KeyBindingComponent(GameSettings.KEY_TOGGLE_INFO_OVERLAY)) + ); + + // Snapped components + public static final @NotNull HudComponentDynamicTooltip DYNAMIC_TOOLTIP = register( + new HudComponentDynamicTooltip("dynamic_tooltip", new LayoutSnap(HOTBAR, ComponentAnchor.TOP_CENTER, ComponentAnchor.BOTTOM_CENTER, 0, -29)) + .addAttachedOption(GameSettings.HIDE_DYNAMIC_TOOLTIP, () -> new BooleanOptionComponent(GameSettings.HIDE_DYNAMIC_TOOLTIP)) + ); + public static final @NotNull HudComponentHealthBar HEALTH_BAR = register( + new HudComponentHealthBar("health_bar", new LayoutSnap(HOTBAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT, 0, -1)) + .addAttachedOption(GameSettings.FOOD_HEALTH_REGEN_OVERLAY, () -> new BooleanOptionComponent(GameSettings.FOOD_HEALTH_REGEN_OVERLAY)) + .addAttachedOption(GameSettings.HIDE_HEALTH_BAR, () -> new BooleanOptionComponent(GameSettings.HIDE_HEALTH_BAR)) + .addAttachedOption(GameSettings.VERTICAL_HEALTH_BAR, () -> new BooleanOptionComponent(GameSettings.VERTICAL_HEALTH_BAR)) + .addAttachedOption(GameSettings.FLIP_HEALTH_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_HEALTH_BAR)) + ); + public static final @NotNull HudComponentArmorBar BOOTS_BAR = register( + new HudComponentArmorBar("boots_bar", new LayoutSnap(HOTBAR, ComponentAnchor.TOP_RIGHT, ComponentAnchor.BOTTOM_RIGHT, 0, -1), HumanArmorShape.BOOTS) + .addAttachedOption(GameSettings.HIDE_BOOTS_BAR, () -> new ToggleableOptionComponent<>(GameSettings.HIDE_BOOTS_BAR)) + .addAttachedOption(GameSettings.FLIP_BOOTS_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_BOOTS_BAR)) + ); + public static final @NotNull HudComponentArmorBar LEGGINGS_BAR = register( + new HudComponentArmorBar("leggings_bar", new LayoutSnap(BOOTS_BAR, ComponentAnchor.CENTER_LEFT, ComponentAnchor.CENTER_RIGHT, -3, 0), HumanArmorShape.LEGS) + .addAttachedOption(GameSettings.HIDE_LEGGINGS_BAR, () -> new ToggleableOptionComponent<>(GameSettings.HIDE_LEGGINGS_BAR)) + .addAttachedOption(GameSettings.FLIP_LEGGINGS_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_LEGGINGS_BAR)) + ); + + public static final @NotNull HudComponentArmorBar CHESTPLATE_BAR = register( + new HudComponentArmorBar("chestplate_bar", new LayoutSnap(LEGGINGS_BAR, ComponentAnchor.CENTER_LEFT, ComponentAnchor.CENTER_RIGHT, -3, 0), HumanArmorShape.CHEST) + .addAttachedOption(GameSettings.HIDE_CHESTPLATE_BAR, () -> new ToggleableOptionComponent<>(GameSettings.HIDE_CHESTPLATE_BAR)) + .addAttachedOption(GameSettings.FLIP_CHESTPLATE_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_CHESTPLATE_BAR)) + ); + public static final @NotNull HudComponentArmorBar HELMET_BAR = register( + new HudComponentArmorBar("helmet_bar", new LayoutSnap(CHESTPLATE_BAR, ComponentAnchor.CENTER_LEFT, ComponentAnchor.CENTER_RIGHT, -3, 0), HumanArmorShape.HEAD) + .addAttachedOption(GameSettings.HIDE_HELMET_BAR, () -> new ToggleableOptionComponent<>(GameSettings.HIDE_HELMET_BAR)) + .addAttachedOption(GameSettings.FLIP_HELMET_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_HELMET_BAR)) + ); + public static final @NotNull HudComponentVehicleHealthBar VEHICLE_BAR = register( + new HudComponentVehicleHealthBar("vehicle_bar", new LayoutSnap(HEALTH_BAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT, 0, -1)) + .addAttachedOption(GameSettings.HIDE_VEHICLE_BAR, () -> new BooleanOptionComponent(GameSettings.HIDE_VEHICLE_BAR)) + .addAttachedOption(GameSettings.VERTICAL_VEHICLE_BAR, () -> new BooleanOptionComponent(GameSettings.VERTICAL_VEHICLE_BAR)) + .addAttachedOption(GameSettings.FLIP_VEHICLE_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_VEHICLE_BAR)) + ); + public static final @NotNull HudComponentOxygenBar OXYGEN_BAR = register( + new HudComponentOxygenBar("oxygen_bar", new LayoutSnap(VEHICLE_BAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT,0, -1)) + .addAttachedOption(GameSettings.HIDE_OXYGEN_BAR, () -> new BooleanOptionComponent(GameSettings.HIDE_OXYGEN_BAR)) + .addAttachedOption(GameSettings.VERTICAL_OXYGEN_BAR, () -> new BooleanOptionComponent(GameSettings.VERTICAL_OXYGEN_BAR)) + .addAttachedOption(GameSettings.FLIP_OXYGEN_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_OXYGEN_BAR)) + ); + public static final @NotNull HudComponentFireBar FIRE_BAR = register( + new HudComponentFireBar("fire_bar", new LayoutSnap(OXYGEN_BAR, ComponentAnchor.TOP_LEFT, ComponentAnchor.BOTTOM_LEFT, 0, -1)) + .addAttachedOption(GameSettings.HIDE_FIRE_BAR, () -> new BooleanOptionComponent(GameSettings.HIDE_FIRE_BAR)) + .addAttachedOption(GameSettings.VERTICAL_FIRE_BAR, () -> new BooleanOptionComponent(GameSettings.VERTICAL_FIRE_BAR)) + .addAttachedOption(GameSettings.FLIP_FIRE_BAR, () -> new BooleanOptionComponent(GameSettings.FLIP_FIRE_BAR)) + ); + public static final @NotNull HudComponentRotationLock ROTATION_LOCK = register( + new HudComponentRotationLock("rotation_lock", new LayoutSnap(CROSSHAIR, ComponentAnchor.CENTER_RIGHT, ComponentAnchor.CENTER_LEFT)) + .addAttachedKeyBinding(GameSettings.KEY_LOCK_ROTATION, () -> new KeyBindingComponent(GameSettings.KEY_LOCK_ROTATION)) + ); + public static final @NotNull HudComponentHeldItemCount HELD_ITEM_COUNT = register( + new HudComponentHeldItemCount("held_item_count", new LayoutSnap(HOTBAR, ComponentAnchor.CENTER_RIGHT, ComponentAnchor.CENTER_LEFT)) + .addAttachedOption(GameSettings.HIDE_HELD_ITEM_COUNT, () -> new BooleanOptionComponent(GameSettings.HIDE_HELD_ITEM_COUNT)) + .addAttachedOption(GameSettings.VERTICAL_HELD_ITEM_COUNT, () -> new BooleanOptionComponent(GameSettings.VERTICAL_HELD_ITEM_COUNT)) + .addAttachedOption(GameSettings.FLIP_HELD_ITEM_COUNT, () -> new BooleanOptionComponent(GameSettings.FLIP_HELD_ITEM_COUNT)) + ); + + public static T register(T component) { + if(INSTANCE == null) throw new IllegalStateException("HudComponents not initialized, Instance is null"); INSTANCE.components.add(component); return component; } private final List components = new ArrayList<>(); - - private HudComponents() { } public List getComponents() { return this.components; } - public HudComponent getComponent(String key) { + public @Nullable HudComponent getComponent(String key) { for (HudComponent component : this.components) { if (component.getKey().equals(key)) { return component; diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutAbsolute.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutAbsolute.java index 0ce40fc8e..b6da0e1e2 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutAbsolute.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutAbsolute.java @@ -3,70 +3,72 @@ package net.minecraft.client.gui.hud.component.layout; import net.minecraft.client.gui.hud.component.ComponentAnchor; import net.minecraft.client.gui.hud.component.HudComponent; import net.minecraft.client.option.GameSettings; +import org.jetbrains.annotations.NotNull; -public class LayoutAbsolute - extends Layout { +public class LayoutAbsolute extends Layout { private float xPosition; private float yPosition; - private ComponentAnchor anchor; + private @NotNull ComponentAnchor anchor; + private int xOffset; + private int yOffset; - public LayoutAbsolute(float xPosition, float yPosition, ComponentAnchor anchor) { - this.xPosition = xPosition; - this.yPosition = yPosition; - this.anchor = anchor; - } - - public float getXPosition() { - return this.xPosition; - } - - public float getYPosition() { - return this.yPosition; - } - - public ComponentAnchor getAnchor() { - return this.anchor; + public LayoutAbsolute(float xPosition, float yPosition, @NotNull ComponentAnchor anchor) { + this(xPosition, yPosition, anchor, 0, 0); } - public void setXPosition(float xPosition) { + public LayoutAbsolute(float xPosition, float yPosition, @NotNull ComponentAnchor anchor, int xOffset, int yOffset) { this.xPosition = xPosition; - } - - public void setYPosition(float yPosition) { this.yPosition = yPosition; - } - - public void setAnchor(ComponentAnchor anchor) { this.anchor = anchor; + this.xOffset = xOffset; + this.yOffset = yOffset; } + public float getXPosition() { return this.xPosition; } + public float getYPosition() { return this.yPosition; } + public @NotNull ComponentAnchor getAnchor() { return this.anchor; } + public int getXOffset() { return this.xOffset; } + public int getYOffset() { return this.yOffset; } + + public void setXPosition(float xPosition) { this.xPosition = xPosition; } + public void setYPosition(float yPosition) { this.yPosition = yPosition; } + public void setAnchor(@NotNull ComponentAnchor anchor) { this.anchor = anchor; } + public void setXOffset(int xOffset) { this.xOffset = xOffset; } + public void setYOffset(int yOffset) { this.yOffset = yOffset; } + @Override - public int getComponentX(HudComponent component, int xSizeScreen) { - int sp = (int) (GameSettings.SCREEN_PADDING.value * mc.resolution.getScaledHeightScreenCoords() / 8); - return (int) (this.xPosition * xSizeScreen) - component.getAnchorX(this.anchor) + sp; + public int getComponentX(@NotNull HudComponent component, int xSizeScreen) { + return (int) (this.xPosition * xSizeScreen) - component.getTrueAnchorX(this.anchor) + this.xOffset; } @Override - public int getComponentY(HudComponent component, int ySizeScreen) { - int sp = (int) (GameSettings.SCREEN_PADDING.value * mc.resolution.getScaledHeightScreenCoords() / 8); - return (int) (this.yPosition * ySizeScreen) - component.getAnchorY(this.anchor) + sp; + public int getComponentY(@NotNull HudComponent component, int ySizeScreen) { + return (int) (this.yPosition * ySizeScreen) - component.getTrueAnchorY(this.anchor) + this.yOffset; } @Override - public Layout copy() { - return new LayoutAbsolute(this.xPosition, this.yPosition, this.anchor); + public @NotNull Layout copy() { + return new LayoutAbsolute(this.xPosition, this.yPosition, this.anchor, this.xOffset, this.yOffset); } @Override - public String toSettingsString() { - return this.xPosition + "," + this.yPosition + "," + this.anchor.name(); + public @NotNull String toSettingsString() { + return this.xPosition + "," + this.yPosition + "," + this.anchor.name() + "," + this.xOffset + "," + this.yOffset; } @Override - public void fromSettingsString(String settings) { + public void fromSettingsString(@NotNull String settings) { String[] parts = settings.split(","); this.xPosition = Float.parseFloat(parts[0]); this.yPosition = Float.parseFloat(parts[1]); this.anchor = ComponentAnchor.valueOf(parts[2]); + + if (parts.length > 3) { + this.xOffset = Integer.parseInt(parts[3]); + this.yOffset = Integer.parseInt(parts[4]); + } else { + this.xOffset = 0; + this.yOffset = 0; + } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutSnap.java b/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutSnap.java index ee443af20..d0cb4cb83 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutSnap.java +++ b/game/client/src/main/java/net/minecraft/client/gui/hud/component/layout/LayoutSnap.java @@ -1,76 +1,95 @@ package net.minecraft.client.gui.hud.component.layout; +import net.minecraft.client.gui.ScreenHudEditor; import net.minecraft.client.gui.hud.component.ComponentAnchor; import net.minecraft.client.gui.hud.component.HudComponent; import net.minecraft.client.gui.hud.component.HudComponents; -import net.minecraft.client.option.GameSettings; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public class LayoutSnap - extends Layout { - private HudComponent parent; - private ComponentAnchor parentAnchor; - private ComponentAnchor anchor; +public class LayoutSnap extends Layout { + private @Nullable HudComponent parent; + private @NotNull ComponentAnchor parentAnchor; + private @NotNull ComponentAnchor anchor; + private int xOffset; + private int yOffset; - public LayoutSnap(HudComponent parent, ComponentAnchor parentAnchor, ComponentAnchor anchor) { + public LayoutSnap(@Nullable HudComponent parent, @NotNull ComponentAnchor parentAnchor, @NotNull ComponentAnchor anchor) { + this(parent, parentAnchor, anchor, 0, 0); + } + + public LayoutSnap(@Nullable HudComponent parent, @NotNull ComponentAnchor parentAnchor, @NotNull ComponentAnchor anchor, int xOffset, int yOffset) { this.parent = parent; this.parentAnchor = parentAnchor; this.anchor = anchor; + this.xOffset = xOffset; + this.yOffset = yOffset; } - public HudComponent getParent() { - return this.parent; - } + public @Nullable HudComponent getParent() { return this.parent; } + public @NotNull ComponentAnchor getParentAnchor() { return this.parentAnchor; } + public @NotNull ComponentAnchor getAnchor() { return this.anchor; } + public int getXOffset() { return this.xOffset; } + public int getYOffset() { return this.yOffset; } - public ComponentAnchor getParentAnchor() { - return this.parentAnchor; - } + public void setParent(@Nullable HudComponent parent) { this.parent = parent; } + public void setParentAnchor(@NotNull ComponentAnchor parentAnchor) { this.parentAnchor = parentAnchor; } + public void setAnchor(@NotNull ComponentAnchor anchor) { this.anchor = anchor; } + public void setXOffset(int xOffset) { this.xOffset = xOffset; } + public void setYOffset(int yOffset) { this.yOffset = yOffset; } - public ComponentAnchor getAnchor() { - return this.anchor; - } + @Override + public int getComponentX(@NotNull HudComponent component, int xSizeScreen) { + if (this.parent == null) { + return (int) (xSizeScreen * this.parentAnchor.xPosition) - component.getTrueAnchorX(this.anchor) + this.xOffset; + } - public void setParent(HudComponent parent) { - this.parent = parent; - } + int posX = this.parent.getLayout().getComponentX(this.parent, xSizeScreen) + - component.getTrueAnchorX(this.anchor) + + this.parent.getTrueAnchorX(this.parentAnchor); - public void setParentAnchor(ComponentAnchor parentAnchor) { - this.parentAnchor = parentAnchor; - } + if (!this.parent.isVisible() && !(mc.currentScreen instanceof ScreenHudEditor)) { + float collapseDirection = this.anchor.xPosition - this.parentAnchor.xPosition; + posX += (int) (collapseDirection * this.parent.getTrueXSize()); + } else { + posX += this.xOffset; + } - public void setAnchor(ComponentAnchor anchor) { - this.anchor = anchor; + return posX; } @Override - public int getComponentX(HudComponent component, int xSizeScreen) { + public int getComponentY(@NotNull HudComponent component, int ySizeScreen) { if (this.parent == null) { - int sp = (int) (GameSettings.SCREEN_PADDING.value * mc.resolution.getScaledHeightScreenCoords() / 8); - return (int) (xSizeScreen * this.parentAnchor.xPosition) - component.getAnchorX(this.anchor) + sp; + return (int) (ySizeScreen * this.parentAnchor.yPosition) - component.getTrueAnchorY(this.anchor) + this.yOffset; } - return this.parent.getLayout().getComponentX(this.parent, xSizeScreen) - component.getAnchorX(this.anchor) + this.parent.getAnchorX(this.parentAnchor); - } - @Override - public int getComponentY( HudComponent component, int ySizeScreen) { - if (this.parent == null) { - int sp = (int) (GameSettings.SCREEN_PADDING.value * mc.resolution.getScaledHeightScreenCoords() / 8); - return (int) (ySizeScreen * this.parentAnchor.yPosition) - component.getAnchorY(this.anchor) + sp; + int posY = this.parent.getLayout().getComponentY(this.parent, ySizeScreen) + - component.getTrueAnchorY(this.anchor) + + this.parent.getTrueAnchorY(this.parentAnchor); + + if (!this.parent.isVisible() && !(mc.currentScreen instanceof ScreenHudEditor)) { + float collapseDirection = this.anchor.yPosition - this.parentAnchor.yPosition; + posY += (int) (collapseDirection * this.parent.getTrueYSize()); + } else { + posY += this.yOffset; } - return this.parent.getLayout().getComponentY(this.parent, ySizeScreen) - component.getAnchorY(this.anchor) + this.parent.getAnchorY(this.parentAnchor); + + return posY; } @Override - public Layout copy() { - return new LayoutSnap(this.parent, this.parentAnchor, this.anchor); + public @NotNull Layout copy() { + return new LayoutSnap(this.parent, this.parentAnchor, this.anchor, this.xOffset, this.yOffset); } @Override - public String toSettingsString() { - return (this.parent == null ? "null" : this.parent.getKey()) + "," + this.parentAnchor.name() + "," + this.anchor.name(); + public @NotNull String toSettingsString() { + return (this.parent == null ? "null" : this.parent.getKey()) + "," + this.parentAnchor.name() + "," + this.anchor.name() + "," + this.xOffset + "," + this.yOffset; } @Override - public void fromSettingsString(String settings) { + public void fromSettingsString(@NotNull String settings) { String[] parts = settings.split(","); if (parts[0].equals("null")) { this.parent = null; @@ -79,5 +98,13 @@ public class LayoutSnap } this.parentAnchor = ComponentAnchor.valueOf(parts[1]); this.anchor = ComponentAnchor.valueOf(parts[2]); + + if (parts.length > 3) { + this.xOffset = Integer.parseInt(parts[3]); + this.yOffset = Integer.parseInt(parts[4]); + } else { + this.xOffset = 0; + this.yOffset = 0; + } } -} +} \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/gui/options/components/KeyBindingComponent.java b/game/client/src/main/java/net/minecraft/client/gui/options/components/KeyBindingComponent.java index 76e5084c4..ec9d54161 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/options/components/KeyBindingComponent.java +++ b/game/client/src/main/java/net/minecraft/client/gui/options/components/KeyBindingComponent.java @@ -42,6 +42,7 @@ public class KeyBindingComponent @Override protected void renderButton(int x, int y, int relativeButtonX, int relativeButtonY, int buttonWidth, int buttonHeight, int relativeMouseX, int relativeMouseY) { + this.keyButton.displayString = this.keyBinding.getKeyName(); super.renderButton(x, y, relativeButtonX, relativeButtonY, buttonWidth, buttonHeight, relativeMouseX, relativeMouseY); this.keyButton.xPosition = x + relativeButtonX; diff --git a/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPageHidden.java b/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPageHidden.java deleted file mode 100644 index 25c3684aa..000000000 --- a/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPageHidden.java +++ /dev/null @@ -1,19 +0,0 @@ -package net.minecraft.client.gui.options.data; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.option.GameSettings; -import net.minecraft.core.item.ItemStack; -import org.jetbrains.annotations.NotNull; - -public class OptionsPageHidden - extends OptionsPage -{ - public OptionsPageHidden(String translationKey, ItemStack icon) { - super(translationKey, icon); - } - - @Override - public boolean isVisible(@NotNull Minecraft mc) { - return GameSettings.DEVELOPER_MODE.value; - } -} diff --git a/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPages.java b/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPages.java index ed1f20033..601296ecc 100644 --- a/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPages.java +++ b/game/client/src/main/java/net/minecraft/client/gui/options/data/OptionsPages.java @@ -83,14 +83,12 @@ public abstract class OptionsPages { .withComponent(new OptionsCategory("gui.options.page.general.category.user_interface") .withComponent(new ShortcutComponent("gui.options.page.general.button.edit_hud", () -> mc.displayScreen(new ScreenHudEditor(mc.currentScreen)))) .withComponent(new ToggleableOptionComponent<>(GameSettings.GUI_SCALE).applyOnRelease()) - .withComponent(new FloatOptionComponent(GameSettings.SCREEN_PADDING)) .withComponent(new TooltipPickerComponent(GameSettings.TOOLTIP_STYLE)) .withComponent(new ToggleableOptionComponent<>(GameSettings.FONT)) .withComponent(new ToggleableOptionComponent<>(GameSettings.chatVisibility)) .withComponent(new BooleanOptionComponent(GameSettings.FPS_IN_OVERLAY)) .withComponent(new BooleanOptionComponent(GameSettings.VERSION_IN_OVERLAY)) .withComponent(new BooleanOptionComponent(GameSettings.FOOD_HEALTH_REGEN_OVERLAY)) - .withComponent(new BooleanOptionComponent(GameSettings.HELD_ITEM_TOOLTIPS)) .withComponent(new ToggleableOptionComponent<>(GameSettings.ITEM_DESCRIPTIONS)) .withComponent(new BooleanOptionComponent(GameSettings.HIDE_UNDISCOVERED_ITEMS)) .withComponent(new BooleanOptionComponent(GameSettings.DYNAMIC_CURSOR)) @@ -246,9 +244,21 @@ public abstract class OptionsPages { .withComponent(new KeyBindingComponent(GameSettings.KEY_PLAYER_LIST)) .withComponent(new KeyBindingComponent(GameSettings.KEY_HIDE_GUI)) .withComponent(new KeyBindingComponent(GameSettings.KEY_TOGGLE_DEBUG)) - .withComponent(new KeyBindingComponent(GameSettings.KEY_TOGGLE_OVERLAY)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_TOGGLE_INFO_OVERLAY)) .withComponent(new KeyBindingComponent(GameSettings.KEY_SORT_INVENTORY)) ) + .withComponent(new OptionsCategory("gui.options.page.controls.category.hud_editor") + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_SELECT)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_OPEN_CONTEXT)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_NUDGE_UP)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_NUDGE_DOWN)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_NUDGE_LEFT)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_NUDGE_RIGHT)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_NUDGE_FAST)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_RESET)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_EXIT)) + .withComponent(new KeyBindingComponent(GameSettings.KEY_HUD_EDITOR_ONBOARDING)) + ) .withComponent(new OptionsCategory("gui.options.page.controls.category.hotbar") .withComponent(new KeyBindingComponent(GameSettings.KEY_HOT_BAR_LEFT)) .withComponent(new KeyBindingComponent(GameSettings.KEY_HOT_BAR_RIGHT)) @@ -289,7 +299,6 @@ public abstract class OptionsPages { .withComponent(new OptionsCategory("gui.options.page.accessibility.category.accessibility") .withComponent(new BooleanOptionComponent(GameSettings.SUBTITLES)) .withComponent(new ToggleableOptionComponent<>(GameSettings.GUI_SCALE).applyOnRelease()) - .withComponent(new FloatOptionComponent(GameSettings.SCREEN_PADDING)) .withComponent(new BooleanOptionComponent(GameSettings.VIEW_BOBBING)) .withComponent(new BooleanOptionComponent(GameSettings.FOV_MODIFICATION)) .withComponent(new BooleanOptionComponent(GameSettings.SCREEN_MOTION_EFFECTS)) @@ -451,14 +460,5 @@ public abstract class OptionsPages { if (Minecraft.getMinecraft().currentWorld != null) Minecraft.getMinecraft().currentWorld.getCommandManager().reload(); })) )); - HIDDEN = register(new OptionsPageHidden("gui.options.page.hidden.title", new ItemStack(Blocks.GLASS_TINTED)) - .withComponent(new OptionsCategory("gui.options.page.hidden.category.general") - .withComponent(new OptionsCategory("gui.options.page.hidden.category.general.userinterface") - .withComponent(new BooleanOptionComponent(GameSettings.ARMOR_DURABILITY_OVERLAY)) - .withComponent(new BooleanOptionComponent(GameSettings.ARMOR_BAR_OVERLAY)) - .withComponent(new BooleanOptionComponent(GameSettings.HELD_ITEM_COUNT_OVERLAY)) - ) - ) - ); } } \ No newline at end of file diff --git a/game/client/src/main/java/net/minecraft/client/input/PlayerInput.java b/game/client/src/main/java/net/minecraft/client/input/PlayerInput.java index 49ad359e7..830b7e6a7 100644 --- a/game/client/src/main/java/net/minecraft/client/input/PlayerInput.java +++ b/game/client/src/main/java/net/minecraft/client/input/PlayerInput.java @@ -1,6 +1,7 @@ package net.minecraft.client.input; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.hud.component.HudComponents; import net.minecraft.client.option.GameSettings; import net.minecraft.core.entity.player.Player; import net.minecraft.core.util.helper.MathHelper; @@ -70,7 +71,7 @@ public class PlayerInput { if(GameSettings.KEY_EASY_BRIDGE.isKeyOrMouse(keyCode, mouseCode) && pressed) { GameSettings.EASY_BRIDGE.toggle(); - this.mc.hudIngame.heldItemTooltipElement.setOptionNameAndValueString(GameSettings.EASY_BRIDGE); + HudComponents.DYNAMIC_TOOLTIP.setOptionNameAndValueString(GameSettings.EASY_BRIDGE); } } diff --git a/game/client/src/main/java/net/minecraft/client/net/handler/PacketHandlerClient.java b/game/client/src/main/java/net/minecraft/client/net/handler/PacketHandlerClient.java index d1a1249d3..8f7eb7252 100644 --- a/game/client/src/main/java/net/minecraft/client/net/handler/PacketHandlerClient.java +++ b/game/client/src/main/java/net/minecraft/client/net/handler/PacketHandlerClient.java @@ -3,6 +3,7 @@ package net.minecraft.client.net.handler; import com.b100.utils.StringUtils; import com.mojang.logging.LogUtils; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.hud.component.HudComponents; import net.minecraft.client.render.particle.ParticlePickupAnimation; import net.minecraft.client.entity.player.PlayerLocal; import net.minecraft.client.entity.player.PlayerRemote; @@ -544,7 +545,7 @@ public class PacketHandlerClient extends PacketHandler { int type = packet.type; if (type == 1) { - this.mc.hudIngame.heldItemTooltipElement.setString(message); + HudComponents.DYNAMIC_TOOLTIP.setString(message); } else { this.mc.hudIngame.addChatMessage(message); } diff --git a/game/client/src/main/java/net/minecraft/client/option/GameSettings.java b/game/client/src/main/java/net/minecraft/client/option/GameSettings.java index 5bb5f5da1..c1a723abd 100644 --- a/game/client/src/main/java/net/minecraft/client/option/GameSettings.java +++ b/game/client/src/main/java/net/minecraft/client/option/GameSettings.java @@ -12,14 +12,11 @@ import net.minecraft.client.gui.hud.component.HudComponents; import net.minecraft.client.gui.options.ScreenOptions; import net.minecraft.client.input.InputDevice; import net.minecraft.client.option.enums.*; -import net.minecraft.client.render.font.Font; import net.minecraft.client.render.font.Fonts; import net.minecraft.client.render.tileentity.TileEntityRendererSign; import net.minecraft.client.world.chunk.provider.SelectedProvider; import net.minecraft.core.entity.player.Player; -import net.minecraft.core.enums.ChatVisibility; -import net.minecraft.core.enums.Difficulty; -import net.minecraft.core.enums.PlacementMode; +import net.minecraft.core.enums.*; import net.minecraft.core.sound.SoundCategory; import net.minecraft.core.util.helper.Color; import net.minecraft.core.util.helper.MathHelper; @@ -38,52 +35,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import static org.lwjgl.input.Keyboard.KEY_1; -import static org.lwjgl.input.Keyboard.KEY_2; -import static org.lwjgl.input.Keyboard.KEY_3; -import static org.lwjgl.input.Keyboard.KEY_4; -import static org.lwjgl.input.Keyboard.KEY_5; -import static org.lwjgl.input.Keyboard.KEY_6; -import static org.lwjgl.input.Keyboard.KEY_7; -import static org.lwjgl.input.Keyboard.KEY_8; -import static org.lwjgl.input.Keyboard.KEY_9; -import static org.lwjgl.input.Keyboard.KEY_A; -import static org.lwjgl.input.Keyboard.KEY_B; -import static org.lwjgl.input.Keyboard.KEY_C; -import static org.lwjgl.input.Keyboard.KEY_COMMA; -import static org.lwjgl.input.Keyboard.KEY_D; -import static org.lwjgl.input.Keyboard.KEY_DOWN; -import static org.lwjgl.input.Keyboard.KEY_E; -import static org.lwjgl.input.Keyboard.KEY_END; -import static org.lwjgl.input.Keyboard.KEY_F; -import static org.lwjgl.input.Keyboard.KEY_F1; -import static org.lwjgl.input.Keyboard.KEY_F11; -import static org.lwjgl.input.Keyboard.KEY_F12; -import static org.lwjgl.input.Keyboard.KEY_F2; -import static org.lwjgl.input.Keyboard.KEY_F3; -import static org.lwjgl.input.Keyboard.KEY_F4; -import static org.lwjgl.input.Keyboard.KEY_F5; -import static org.lwjgl.input.Keyboard.KEY_F8; -import static org.lwjgl.input.Keyboard.KEY_G; -import static org.lwjgl.input.Keyboard.KEY_GRAVE; -import static org.lwjgl.input.Keyboard.KEY_H; -import static org.lwjgl.input.Keyboard.KEY_L; -import static org.lwjgl.input.Keyboard.KEY_LCONTROL; -import static org.lwjgl.input.Keyboard.KEY_LSHIFT; -import static org.lwjgl.input.Keyboard.KEY_N; -import static org.lwjgl.input.Keyboard.KEY_P; -import static org.lwjgl.input.Keyboard.KEY_PERIOD; -import static org.lwjgl.input.Keyboard.KEY_Q; -import static org.lwjgl.input.Keyboard.KEY_R; -import static org.lwjgl.input.Keyboard.KEY_S; -import static org.lwjgl.input.Keyboard.KEY_SLASH; -import static org.lwjgl.input.Keyboard.KEY_SPACE; -import static org.lwjgl.input.Keyboard.KEY_T; -import static org.lwjgl.input.Keyboard.KEY_TAB; -import static org.lwjgl.input.Keyboard.KEY_U; -import static org.lwjgl.input.Keyboard.KEY_UP; -import static org.lwjgl.input.Keyboard.KEY_W; -import static org.lwjgl.input.Keyboard.KEY_Z; +import static org.lwjgl.input.Keyboard.*; public final class GameSettings { private static final @NotNull Logger LOGGER = LogUtils.getLogger(); @@ -145,11 +97,6 @@ public final class GameSettings { return (int) (option.value * 200F) + "%"; } })); - public static final @NotNull OptionFloat SCREEN_PADDING = register(new OptionFloat("screenPadding", 0.0f) - .withDisplayStringProvider((mc, i18n, option) -> { - int percent = (int) (option.value * 100); - return percent + "%"; - })); public static final @NotNull OptionFloat GAMMA = register(new OptionFloat("gamma", 0.5f) .withDisplayStringProvider((mc, i18n, option) -> { int percent = (int) (option.value * 200); @@ -257,9 +204,7 @@ public final class GameSettings { } })); public static final @NotNull OptionBoolean ARMOR_DURABILITY_OVERLAY = register(new OptionBoolean("armorDurabilityOverlay", false)); - public static final @NotNull OptionBoolean ARMOR_BAR_OVERLAY = register(new OptionBoolean("armorBarOverlay", false)); public static final @NotNull OptionBoolean ARMOR_PROTECTION_OVERLAY = register(new OptionBoolean("armorProtectionOverlay", true)); - public static final @NotNull OptionBoolean HELD_ITEM_COUNT_OVERLAY = register(new OptionBoolean("heldItemCountOverlay", false)); public static final @NotNull OptionBoolean PAUSE_ON_LOST_FOCUS = register(new OptionBoolean("pauseOnLostFocus", true)); public static final @NotNull OptionBoolean SHOW_DEBUG_SCREEN = register(new OptionBoolean("showDebugScreen", false)); public static final @NotNull OptionBoolean SHOW_FRAME_TIMES = register(new OptionBoolean("showFrameTimes", false)); @@ -347,7 +292,6 @@ public final class GameSettings { mc.renderGlobal.allChanged(); })); public static final @NotNull OptionInteger PLAYER_LIST_POSITION = register(new OptionInteger("playerListPosition", 2)); - public static final @NotNull OptionBoolean HELD_ITEM_TOOLTIPS = register(new OptionBoolean("heldItemTooltips", true)); public static final @NotNull OptionFloat COLOR_CORRECTION = register(new OptionFloat("colorCorrection", 0.5f)); public static final @NotNull OptionBoolean SNEAK_TOGGLE = register(new OptionBoolean("sneakToggle", false)); public static final @NotNull OptionFloat AUTOSAVE_TIMER = register(new OptionFloat("autosaveTimer", 0.04166666666F) @@ -392,14 +336,14 @@ public final class GameSettings { public static final @NotNull OptionBoolean ALLOW_SOUND_OVERRIDES = register(new OptionBoolean("allowSoundOverrides", false)); public static final @NotNull OptionBoolean LOAD_ALL_SOUNDS = register(new OptionBoolean("loadAllSounds", false)); - public static final @NotNull OptionBoolean OVERLAY_SHOW_COORDS = register(new OptionBoolean("overlayShowCoords", true)); - public static final @NotNull OptionBoolean OVERLAY_SHOW_DIRECTION = register(new OptionBoolean("overlayShowDirection", true)); - public static final @NotNull OptionBoolean OVERLAY_SHOW_TIME = register(new OptionBoolean("overlayShowTime", true)); - public static final @NotNull OptionBoolean OVERLAY_SHOW_SEASON = register(new OptionBoolean("overlayShowSeason", true)); - public static final @NotNull OptionBoolean OVERLAY_SHOW_WEATHER = register(new OptionBoolean("overlayShowWeather", true)); - public static final @NotNull OptionBoolean OVERLAY_SHOW_BIOME = register(new OptionBoolean("overlayShowBiome", true)); + public static final @NotNull OptionBoolean COORDS_IN_OVERLAY = register(new OptionBoolean("coordsInOverlay", true)); + public static final @NotNull OptionBoolean DIRECTION_IN_OVERLAY = register(new OptionBoolean("directionInOverlay", true)); + public static final @NotNull OptionBoolean TIME_IN_OVERLAY = register(new OptionBoolean("timeInOverlay", true)); + public static final @NotNull OptionBoolean SEASON_IN_OVERLAY = register(new OptionBoolean("seasonInOverlay", true)); + public static final @NotNull OptionBoolean WEATHER_IN_OVERLAY = register(new OptionBoolean("weatherInOverlay", true)); + public static final @NotNull OptionBoolean BIOME_IN_OVERLAY = register(new OptionBoolean("biomeInOverlay", true)); - public static final @NotNull OptionBoolean @NotNull [] OVERLAY_ELEMENTS = new OptionBoolean[]{OVERLAY_SHOW_COORDS, OVERLAY_SHOW_DIRECTION, OVERLAY_SHOW_TIME, OVERLAY_SHOW_SEASON, OVERLAY_SHOW_WEATHER, OVERLAY_SHOW_BIOME}; + public static final @NotNull OptionBoolean @NotNull [] OVERLAY_ELEMENTS = new OptionBoolean[]{COORDS_IN_OVERLAY, DIRECTION_IN_OVERLAY, TIME_IN_OVERLAY, SEASON_IN_OVERLAY, WEATHER_IN_OVERLAY, BIOME_IN_OVERLAY}; public static final @NotNull OptionString LAST_SERVER = register(new OptionString("lastServer", "")); public static final @NotNull OptionString SKIN = register(new OptionString("skin", "Default")); @@ -521,6 +465,69 @@ public final class GameSettings { } })); + //HudComponent Options (if already existent and, like keybinds, they just point to their respective category/existent option) + + public static final @NotNull OptionBoolean SEEN_HUD_EDITOR_ONBOARDING = register(new OptionBoolean("seenHudEditorOnboarding", false)); + + public static final @NotNull OptionBoolean HIDE_HEALTH_BAR = register(new OptionBoolean("hideHealthBar", false)); + public static final @NotNull OptionBoolean HIDE_OXYGEN_BAR = register(new OptionBoolean("hideOxygenBar", false)); + public static final @NotNull OptionBoolean HIDE_FIRE_BAR = register(new OptionBoolean("hideFireBar", false)); + public static final @NotNull OptionBoolean HIDE_VEHICLE_BAR = register(new OptionBoolean("hideVehicleBar", false)); + public static final @NotNull OptionBoolean HIDE_DYNAMIC_TOOLTIP = register(new OptionBoolean("hideDynamicTooltip", false)); + public static final @NotNull OptionBoolean HIDE_HELD_ITEM_COUNT = register(new OptionBoolean("hideHeldItemCount", true)); + + public static final @NotNull OptionEnum HIDE_HELMET_BAR = register( + new OptionEnum<>("hideHelmetBar", ArmorHiddenState.class, ArmorHiddenState.NEVER) + .setIsSlider(true) + ); + public static final @NotNull OptionEnum HIDE_CHESTPLATE_BAR = register( + new OptionEnum<>("hideChestplateBar", ArmorHiddenState.class, ArmorHiddenState.NEVER) + .setIsSlider(true) + ); + public static final @NotNull OptionEnum HIDE_LEGGINGS_BAR = register( + new OptionEnum<>("hideLeggingsBar", ArmorHiddenState.class, ArmorHiddenState.NEVER) + .setIsSlider(true) + ); + public static final @NotNull OptionEnum HIDE_BOOTS_BAR = register( + new OptionEnum<>("hideBootsBar", ArmorHiddenState.class, ArmorHiddenState.NEVER) + .setIsSlider(true) + ); + + public static final @NotNull OptionBoolean VERTICAL_HOT_BAR = register(new OptionBoolean("verticalHotBar", false)); + public static final @NotNull OptionBoolean VERTICAL_HELD_ITEM_COUNT = register(new OptionBoolean("verticalHeldItemCount", false)); + public static final @NotNull OptionBoolean VERTICAL_HEALTH_BAR = register(new OptionBoolean("verticalHealthBar", false)); + public static final @NotNull OptionBoolean VERTICAL_OXYGEN_BAR = register(new OptionBoolean("verticalOxygenBar", false)); + public static final @NotNull OptionBoolean VERTICAL_VEHICLE_BAR = register(new OptionBoolean("verticalVehicleBar", false)); + public static final @NotNull OptionBoolean VERTICAL_FIRE_BAR = register(new OptionBoolean("verticalFireBar", false)); + + public static final @NotNull OptionBoolean FLIP_HELD_ITEM_COUNT = register(new OptionBoolean("flipHeldItemCount", false)); + public static final @NotNull OptionBoolean FLIP_HELMET_BAR = register(new OptionBoolean("flipHelmetBar", false)); + public static final @NotNull OptionBoolean FLIP_CHESTPLATE_BAR = register(new OptionBoolean("flipChestplateBar", false)); + public static final @NotNull OptionBoolean FLIP_LEGGINGS_BAR = register(new OptionBoolean("flipLeggingsBar", false)); + public static final @NotNull OptionBoolean FLIP_BOOTS_BAR = register(new OptionBoolean("flipBootsBar", false)); + public static final @NotNull OptionBoolean FLIP_HEALTH_BAR = register(new OptionBoolean("flipHealthBar", false)); + public static final @NotNull OptionBoolean FLIP_OXYGEN_BAR = register(new OptionBoolean("flipOxygenBar", false)); + public static final @NotNull OptionBoolean FLIP_VEHICLE_BAR = register(new OptionBoolean("flipVehicleBar", false)); + public static final @NotNull OptionBoolean FLIP_FIRE_BAR = register(new OptionBoolean("flipFireBar", false)); + + public static final @NotNull OptionEnum HORIZONTAL_INFO_TEXT_ALIGNMENT = register( + new OptionEnum<>("horizontalInfoTextAlignment", HorizontalTextAlignment.class, HorizontalTextAlignment.LEFT) + .setIsSlider(true) + ); + public static final @NotNull OptionEnum HORIZONTAL_LOG_TEXT_ALIGNMENT = register( + new OptionEnum<>("horizontalLogTextAlignment", HorizontalTextAlignment.class, HorizontalTextAlignment.LEFT) + .setIsSlider(true) + ); + public static final @NotNull OptionEnum VERTICAL_INFO_TEXT_ALIGNMENT = register( + new OptionEnum<>("verticalInfoTextAlignment", VerticalTextAlignment.class, VerticalTextAlignment.TOP) + .setIsSlider(true) + ); + public static final @NotNull OptionEnum VERTICAL_LOG_TEXT_ALIGNMENT = register( + new OptionEnum<>("verticalLogTextAlignment", VerticalTextAlignment.class, VerticalTextAlignment.TOP) + .setIsSlider(true) + ); + + //KeyBind Options public static final @NotNull KeyBinding KEY_ATTACK = register(new KeyBinding("key.attack").setDefault(InputDevice.mouse, 0)); public static final @NotNull KeyBinding KEY_INTERACT = register(new KeyBinding("key.interact").setDefault(InputDevice.mouse, 1)); public static final @NotNull KeyBinding KEY_PICK_BLOCK = register(new KeyBinding("key.pickBlock").setDefault(InputDevice.mouse, 2)); @@ -549,7 +556,7 @@ public final class GameSettings { public static final @NotNull KeyBinding KEY_HIDE_GUI = register(new KeyBinding("key.immersiveMode").setDefault(InputDevice.keyboard, KEY_F1)); public static final @NotNull KeyBinding KEY_SCREENSHOT = register(new KeyBinding("key.screenshot").setDefault(InputDevice.keyboard, KEY_F2)); public static final @NotNull KeyBinding KEY_TOGGLE_DEBUG = register(new KeyBinding("key.toggleDebug").setDefault(InputDevice.keyboard, KEY_F3)); - public static final @NotNull KeyBinding KEY_TOGGLE_OVERLAY = register(new KeyBinding("key.toggleOverlay").setDefault(InputDevice.keyboard, KEY_F4)); + public static final @NotNull KeyBinding KEY_TOGGLE_INFO_OVERLAY = register(new KeyBinding("key.toggleInfoOverlay").setDefault(InputDevice.keyboard, KEY_F4)); public static final @NotNull KeyBinding KEY_SWITCH_PERSPECTIVE = register(new KeyBinding("key.switchPerspective").setDefault(InputDevice.keyboard, KEY_F5)); public static final @NotNull KeyBinding KEY_CINEMATIC_CAMERA = register(new KeyBinding("key.cinematicCamera").setDefault(InputDevice.keyboard, KEY_F8)); public static final @NotNull KeyBinding KEY_FULL_SCREEN = register(new KeyBinding("key.fullscreen").setDefault(InputDevice.keyboard, KEY_F11)); @@ -581,6 +588,17 @@ public final class GameSettings { public static final @NotNull KeyBinding KEY_OPEN_STATISTICS = register(new KeyBinding("key.openStatistics")); public static final @NotNull KeyBinding KEY_SHOW_CONSOLE = register(new KeyBinding("key.showConsole").setDefault(InputDevice.keyboard, KEY_GRAVE)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_SELECT = register(new KeyBinding("key.hudEditorSelect").setDefault(InputDevice.mouse, 0)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_OPEN_CONTEXT = register(new KeyBinding("key.hudEditorOpenContext").setDefault(InputDevice.mouse, 1)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_EXIT = register(new KeyBinding("key.hudEditorExit").setDefault(InputDevice.keyboard, KEY_ESCAPE)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_RESET = register(new KeyBinding("key.hudEditorReset").setDefault(InputDevice.keyboard, KEY_R)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_NUDGE_UP = register(new KeyBinding("key.hudEditorNudgeUp").setDefault(InputDevice.keyboard, KEY_UP)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_NUDGE_DOWN = register(new KeyBinding("key.hudEditorNudgeDown").setDefault(InputDevice.keyboard, KEY_DOWN)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_NUDGE_LEFT = register(new KeyBinding("key.hudEditorNudgeLeft").setDefault(InputDevice.keyboard, Keyboard.KEY_LEFT)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_NUDGE_RIGHT = register(new KeyBinding("key.hudEditorNudgeRight").setDefault(InputDevice.keyboard, Keyboard.KEY_RIGHT)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_NUDGE_FAST = register(new KeyBinding("key.hudEditorNudgeFast").setDefault(InputDevice.keyboard, KEY_LSHIFT)); + public static final @NotNull KeyBinding KEY_HUD_EDITOR_ONBOARDING = register(new KeyBinding("key.hudEditorOnboarding").setDefault(InputDevice.keyboard, KEY_O)); + public static final @NotNull List DEBUG_KEYS = new ArrayList<>(); public static final @NotNull KeyBinding KEY_RELOAD = register(new KeyBinding("key.debug.reload").setDefault(InputDevice.keyboard, KEY_R)); public static final @NotNull KeyBinding KEY_SWITCH_GAMEMODE = register(new KeyBinding("key.debug.gamemode").setDefault(InputDevice.keyboard, KEY_N)); diff --git a/game/client/src/main/java/net/minecraft/client/util/helper/ItemDragHandler.java b/game/client/src/main/java/net/minecraft/client/util/helper/ItemDragHandler.java index 185e962b9..a51f2bcb6 100644 --- a/game/client/src/main/java/net/minecraft/client/util/helper/ItemDragHandler.java +++ b/game/client/src/main/java/net/minecraft/client/util/helper/ItemDragHandler.java @@ -29,8 +29,6 @@ public class ItemDragHandler extends Gui { private final IntSet cancelRelease = new IntArraySet(); - /////////////////////// - private int cancelButtonRelease = -1; private int draggingButton = -1; @@ -40,7 +38,7 @@ public class ItemDragHandler extends Gui { private ItemStack renderItemStack; private int renderItemStackCount; - // For double clicking to pick up all similar items + // For double-clicking to pick up all similar items private Slot lastClickSlot = null; private long lastClickTime = 0; private boolean lastClickHoldingItem = false; diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/empty/empty.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/empty/empty.png new file mode 100644 index 000000000..b78fa44a2 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/empty/empty.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/chainmail.png new file mode 100644 index 000000000..0a27bfc08 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/diamond.png new file mode 100644 index 000000000..6043dcc30 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/gold.png new file mode 100644 index 000000000..d5ccd480a Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/iron.png new file mode 100644 index 000000000..36d3cecb6 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/leather.png new file mode 100644 index 000000000..e79dbc2e1 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/steel.png new file mode 100644 index 000000000..1a76bdf2a Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/full/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/chainmail.png new file mode 100644 index 000000000..506c18760 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/diamond.png new file mode 100644 index 000000000..4181d4ebb Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/chainmail.png new file mode 100644 index 000000000..accb2de26 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/diamond.png new file mode 100644 index 000000000..2d9b3571a Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/gold.png new file mode 100644 index 000000000..9c7e751d9 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/iron.png new file mode 100644 index 000000000..c628a0e78 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/leather.png new file mode 100644 index 000000000..043696cc2 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/steel.png new file mode 100644 index 000000000..66804292f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/flipped/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/gold.png new file mode 100644 index 000000000..74db4cb51 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/iron.png new file mode 100644 index 000000000..41a51be98 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/leather.png new file mode 100644 index 000000000..92dbe8abe Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/steel.png new file mode 100644 index 000000000..bbae58999 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/half/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/infinite/iceskates.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/infinite/iceskates.png new file mode 100644 index 000000000..e2082cceb Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/boots/infinite/iceskates.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/empty/empty.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/empty/empty.png new file mode 100644 index 000000000..0c0c04588 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/empty/empty.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/empty/quiver.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/empty/quiver.png new file mode 100644 index 000000000..6f4e32d14 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/empty/quiver.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/chainmail.png new file mode 100644 index 000000000..d2c7188eb Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/diamond.png new file mode 100644 index 000000000..953e33a8e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/gold.png new file mode 100644 index 000000000..4e7470434 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/iron.png new file mode 100644 index 000000000..48330aec1 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/leather.png new file mode 100644 index 000000000..738072ffb Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/quiver.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/quiver.png new file mode 100644 index 000000000..22b7b8a67 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/quiver.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/steel.png new file mode 100644 index 000000000..bf8d492ea Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/full/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/chainmail.png new file mode 100644 index 000000000..9a0a1118f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/diamond.png new file mode 100644 index 000000000..629be664c Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/chainmail.png new file mode 100644 index 000000000..9ceba6a84 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/diamond.png new file mode 100644 index 000000000..345086260 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/gold.png new file mode 100644 index 000000000..6ff4c8fc5 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/iron.png new file mode 100644 index 000000000..8a94d7f5e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/leather.png new file mode 100644 index 000000000..4a89e9f8a Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/quiver.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/quiver.png new file mode 100644 index 000000000..a146c5c3c Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/quiver.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/steel.png new file mode 100644 index 000000000..af16f35d6 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/flipped/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/gold.png new file mode 100644 index 000000000..62ed1d67b Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/iron.png new file mode 100644 index 000000000..1bf2e0aae Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/leather.png new file mode 100644 index 000000000..3330f6b79 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/quiver.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/quiver.png new file mode 100644 index 000000000..a146c5c3c Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/quiver.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/steel.png new file mode 100644 index 000000000..b2723fe76 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/half/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/infinite/quiver_gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/infinite/quiver_gold.png new file mode 100644 index 000000000..ec7d8ca18 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/chestplate/infinite/quiver_gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/empty/empty.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/empty/empty.png new file mode 100644 index 000000000..387eedb94 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/empty/empty.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/chainmail.png new file mode 100644 index 000000000..6969ddfb2 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/diamond.png new file mode 100644 index 000000000..ef1d45b9e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/gold.png new file mode 100644 index 000000000..0ac0ac915 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/iron.png new file mode 100644 index 000000000..165b1a025 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/leather.png new file mode 100644 index 000000000..a715e4fad Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/steel.png new file mode 100644 index 000000000..8a7e17244 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/full/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/chainmail.png new file mode 100644 index 000000000..36e966ffa Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/diamond.png new file mode 100644 index 000000000..0de7e7659 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/chainmail.png new file mode 100644 index 000000000..549808b1e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/diamond.png new file mode 100644 index 000000000..e7b1606ca Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/gold.png new file mode 100644 index 000000000..52dceb270 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/iron.png new file mode 100644 index 000000000..54e117ccc Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/leather.png new file mode 100644 index 000000000..9ee96350f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/steel.png new file mode 100644 index 000000000..63ee3781f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/flipped/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/gold.png new file mode 100644 index 000000000..62f1abb7d Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/iron.png new file mode 100644 index 000000000..fe613291f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/leather.png new file mode 100644 index 000000000..c18f8ae23 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/steel.png new file mode 100644 index 000000000..286016848 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/half/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/block_generic.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/block_generic.png new file mode 100644 index 000000000..4ee894a78 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/block_generic.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic.png new file mode 100644 index 000000000..4ee894a78 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_apple_unused.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_apple_unused.png new file mode 100644 index 000000000..80be06e1e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_apple_unused.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_diamond_unused.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_diamond_unused.png new file mode 100644 index 000000000..5322baa70 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_diamond_unused.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_pearl_unused.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_pearl_unused.png new file mode 100644 index 000000000..facae173c Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/helmet/infinite/item_generic_pearl_unused.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/empty/empty.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/empty/empty.png new file mode 100644 index 000000000..a7c80b745 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/empty/empty.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/chainmail.png new file mode 100644 index 000000000..5167cf839 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/diamond.png new file mode 100644 index 000000000..b3a51cf40 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/gold.png new file mode 100644 index 000000000..b22465966 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/iron.png new file mode 100644 index 000000000..44b85925a Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/leather.png new file mode 100644 index 000000000..b1c7af6a6 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/steel.png new file mode 100644 index 000000000..f9a71fc3f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/full/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/chainmail.png new file mode 100644 index 000000000..289544add Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/diamond.png new file mode 100644 index 000000000..67684ff10 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/chainmail.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/chainmail.png new file mode 100644 index 000000000..99102722e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/chainmail.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/diamond.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/diamond.png new file mode 100644 index 000000000..d8b87b611 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/diamond.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/gold.png new file mode 100644 index 000000000..be29834c4 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/iron.png new file mode 100644 index 000000000..cfb24a4a8 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/leather.png new file mode 100644 index 000000000..673024fcb Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/steel.png new file mode 100644 index 000000000..47779f165 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/flipped/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/gold.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/gold.png new file mode 100644 index 000000000..e4b5bbcb5 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/gold.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/iron.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/iron.png new file mode 100644 index 000000000..997e00464 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/iron.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/leather.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/leather.png new file mode 100644 index 000000000..58e150afc Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/leather.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/steel.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/steel.png new file mode 100644 index 000000000..10a81687b Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/armor/leggings/half/steel.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_full.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/full.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_full.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/full.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_full_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/full_blinking.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_full_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/full_blinking.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_half.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_half_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_half_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_flipped.png new file mode 100644 index 000000000..1376b7f2c Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_vertical.png new file mode 100644 index 000000000..95b471ada Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_vertical_flipped.png new file mode 100644 index 000000000..2925d3394 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_blinking_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_flipped.png new file mode 100644 index 000000000..781eab0c0 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_vertical.png new file mode 100644 index 000000000..f91fac414 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_vertical_flipped.png new file mode 100644 index 000000000..27b874b01 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/half_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_preview_full.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/full.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_preview_full.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/full.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_preview_half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_preview_half.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_flipped.png new file mode 100644 index 000000000..e7f6ea01f Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_preview_half_right.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore_preview_half_right.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_flipped.png new file mode 100644 index 000000000..51cdb5ced Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_vertical.png new file mode 100644 index 000000000..5adaf1a98 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_vertical_flipped.png new file mode 100644 index 000000000..cfd048dea Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_right_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_vertical.png new file mode 100644 index 000000000..4fa380e90 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_vertical_flipped.png new file mode 100644 index 000000000..2161f6e6c Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/hardcore/preview/half_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_full.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_full.png deleted file mode 100644 index 86e1873ad..000000000 Binary files a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_full.png and /dev/null differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_full_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_full_blinking.png deleted file mode 100644 index 1938633cc..000000000 Binary files a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_full_blinking.png and /dev/null differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_half.png deleted file mode 100644 index f3ad6098c..000000000 Binary files a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_half.png and /dev/null differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_half_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_half_blinking.png deleted file mode 100644 index 6d00a065c..000000000 Binary files a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/overheal_half_blinking.png and /dev/null differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/full.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/full.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/full.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/full.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/full_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/full_blinking.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/full_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/full_blinking.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/half.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/half_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/half_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_flipped.png new file mode 100644 index 000000000..515043b6e Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_vertical.png new file mode 100644 index 000000000..e6bd3a027 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_vertical_flipped.png new file mode 100644 index 000000000..27bf3c6c8 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_blinking_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_flipped.png new file mode 100644 index 000000000..532270e8d Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_vertical.png new file mode 100644 index 000000000..e8d26a2f3 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_vertical_flipped.png new file mode 100644 index 000000000..d0be27501 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/half_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/preview_full.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/full.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/preview_full.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/full.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/preview_half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/preview_half.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_flipped.png new file mode 100644 index 000000000..cd096ea02 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/preview_half_right.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/preview_half_right.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_flipped.png new file mode 100644 index 000000000..a2a67224b Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_vertical.png new file mode 100644 index 000000000..6e8879da5 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_vertical_flipped.png new file mode 100644 index 000000000..cfd048dea Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_right_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_vertical.png new file mode 100644 index 000000000..ef81c2fb5 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_vertical_flipped.png new file mode 100644 index 000000000..69cf087d2 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/survival/preview/half_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/container.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/container.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/container.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/container.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/container_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/container_blinking.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/container_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/container_blinking.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/full.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/full.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/full.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/full.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/full_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/full_blinking.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/full_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/full_blinking.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half.png new file mode 100644 index 000000000..de836f4e2 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking.png new file mode 100644 index 000000000..a7a50500b Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/half_blinking.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_flipped.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/half_blinking.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_flipped.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_vertical.png new file mode 100644 index 000000000..b60f69ea8 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_vertical_flipped.png new file mode 100644 index 000000000..92a456284 Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_blinking_vertical_flipped.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/half.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_flipped.png similarity index 100% rename from game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/pig/half.png rename to game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_flipped.png diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_vertical.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_vertical.png new file mode 100644 index 000000000..49677edbc Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_vertical.png differ diff --git a/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_vertical_flipped.png b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_vertical_flipped.png new file mode 100644 index 000000000..9e60d083a Binary files /dev/null and b/game/client/src/main/resources/assets/minecraft/textures/gui/sprites/hud/heart/vehicle/pig/half_vertical_flipped.png differ diff --git a/game/core/src/main/java/net/minecraft/core/enums/ArmorHiddenState.java b/game/core/src/main/java/net/minecraft/core/enums/ArmorHiddenState.java new file mode 100644 index 000000000..0e44b3927 --- /dev/null +++ b/game/core/src/main/java/net/minecraft/core/enums/ArmorHiddenState.java @@ -0,0 +1,7 @@ +package net.minecraft.core.enums; + +public enum ArmorHiddenState { + NEVER, + WHEN_NOT_WEARING, + ALWAYS +} diff --git a/game/core/src/main/java/net/minecraft/core/enums/HorizontalTextAlignment.java b/game/core/src/main/java/net/minecraft/core/enums/HorizontalTextAlignment.java new file mode 100644 index 000000000..c2912fae3 --- /dev/null +++ b/game/core/src/main/java/net/minecraft/core/enums/HorizontalTextAlignment.java @@ -0,0 +1,13 @@ +package net.minecraft.core.enums; + +public enum HorizontalTextAlignment { + LEFT(0.0f), + CENTER(0.5f), + RIGHT(1.0f); + + public final float multiplier; + + HorizontalTextAlignment(float multiplier) { + this.multiplier = multiplier; + } +} diff --git a/game/core/src/main/java/net/minecraft/core/enums/VerticalTextAlignment.java b/game/core/src/main/java/net/minecraft/core/enums/VerticalTextAlignment.java new file mode 100644 index 000000000..8fe93dbd2 --- /dev/null +++ b/game/core/src/main/java/net/minecraft/core/enums/VerticalTextAlignment.java @@ -0,0 +1,13 @@ +package net.minecraft.core.enums; + +public enum VerticalTextAlignment { + TOP(0.0f), + CENTER(0.5f), + BOTTOM(1.0f); + + public final float multiplier; + + VerticalTextAlignment(float multiplier) { + this.multiplier = multiplier; + } +} diff --git a/game/core/src/main/java/net/minecraft/core/net/command/helpers/WorldFeatureParser.java b/game/core/src/main/java/net/minecraft/core/net/command/helpers/WorldFeatureParser.java index a89a13518..6d839045e 100644 --- a/game/core/src/main/java/net/minecraft/core/net/command/helpers/WorldFeatureParser.java +++ b/game/core/src/main/java/net/minecraft/core/net/command/helpers/WorldFeatureParser.java @@ -65,7 +65,7 @@ public class WorldFeatureParser { throw NO_PARAMETERS.createWithContext(this.reader); } try { - return (WorldFeature) constructor.newInstance(); + return (WorldFeatureInterface) constructor.newInstance(); } catch (Exception e) { throw new CommandSyntaxException(CommandSyntaxException.BUILT_IN_EXCEPTIONS.dispatcherUnknownArgument(), () -> I18n.getInstance().translateKey("command.argument_types.world_feature.invalid_world_feature")); } diff --git a/game/core/src/main/resources/assets/minecraft/lang/en_US/gui.lang b/game/core/src/main/resources/assets/minecraft/lang/en_US/gui.lang index 93e6683de..a2406e4fa 100644 --- a/game/core/src/main/resources/assets/minecraft/lang/en_US/gui.lang +++ b/game/core/src/main/resources/assets/minecraft/lang/en_US/gui.lang @@ -215,7 +215,7 @@ gui.options.label.picking_keybinding=Press a key or mouse button to set it as th gui.options.page.general.title=General gui.options.page.general.button.open_worlds_folder=Open Worlds Folder gui.options.page.general.button.open_screenshots_folder=Open Screenshots Folder -gui.options.page.general.button.edit_hud=Edit HUD... +gui.options.page.general.button.edit_hud=Open HUD Editor... gui.options.page.general.category.gameplay=Gameplay gui.options.page.general.category.user_interface=User Interface gui.options.page.general.category.miscellaneous=Miscellaneous @@ -245,6 +245,7 @@ gui.options.page.controls.category.controller=Controller gui.options.page.controls.category.interactions=Interactions gui.options.page.controls.category.movement=Movement gui.options.page.controls.category.user_interface=User Interface +gui.options.page.controls.category.hud_editor=HUD Editor gui.options.page.controls.category.hotbar=Hotbar gui.options.page.controls.category.view=View gui.options.page.controls.category.miscellaneous=Miscellaneous @@ -297,6 +298,17 @@ gui.options.difficultylock.warning.1=Are you sure you wish gui.options.difficultylock.warning.2=to lock this world's difficulty? gui.options.difficultylock.warning.3=(This cannot be undone) +gui.options.hudeditor.onboarding.welcome=Welcome to the HUD Editor! +gui.options.hudeditor.onboarding.select=Press '%1$s' to select a component +gui.options.hudeditor.onboarding.drag=Drag while holding '%1$s' to move component +gui.options.hudeditor.onboarding.context=Press '%1$s' while hovering over a component for contextual settings +gui.options.hudeditor.onboarding.nudge=Press '%1$s' to nudge any selected component +gui.options.hudeditor.onboarding.nudge_fast=Hold '%1$s' to nudge faster +gui.options.hudeditor.onboarding.reset=Press '%1$s' to reset layout to default +gui.options.hudeditor.onboarding.exit=Press '%1$s' to leave the HUD Editor +gui.options.hudeditor.onboarding.reopen=Press '%1$s' to see this screen again! +gui.options.hudeditor.onboarding.begin=Click anywhere to begin + gui.sound_test.label.title=Sound Test gui.sound_test.label.repo=Sound Repository: %s gui.sound_test.label.id=ID: %s diff --git a/game/core/src/main/resources/assets/minecraft/lang/en_US/options.lang b/game/core/src/main/resources/assets/minecraft/lang/en_US/options.lang index 3d7a6fa05..1e57d8946 100644 --- a/game/core/src/main/resources/assets/minecraft/lang/en_US/options.lang +++ b/game/core/src/main/resources/assets/minecraft/lang/en_US/options.lang @@ -120,14 +120,13 @@ options.entityRenderDistance=Entity Render Distance options.entityRenderDistance.default=Default options.armorDurabilityOverlay=Armor Durability Overlay options.armorBarOverlay=Armor Bar Overlay -options.overlayShowCoords=Coordinates -options.overlayShowDirection=Direction -options.overlayShowTime=Time -options.overlayShowSeason=Season -options.overlayShowWeather=Weather -options.overlayShowBiome=Biome +options.coordsInOverlay=Coordinates in Overlay +options.directionInOverlay=Direction in Overlay +options.timeInOverlay=Time in Overlay +options.seasonInOverlay=Season in Overlay +options.weatherInOverlay=Weather in Overlay +options.biomeInOverlay=Biome in Overlay options.rawMouseInput=Raw Mouse Input -options.heldItemCountOverlay=Held Item Count Overlay options.swapCraftingButtons=Swap Crafting Buttons options.fullscreen=Full Screen options.borderlessFullscreen=Borderless Fullscreen @@ -135,7 +134,6 @@ options.borderlessFullscreen.unavailable=Not Available options.enableVbos=Enable VBOs options.discordRichPresence=Discord Rich Presence options.blockOutlineWidth=Outline Visibility -options.heldItemTooltips=Held Item Tooltips options.colorCorrection=Color Correction options.colorCorrection.low=Low options.colorCorrection.high=High @@ -265,6 +263,70 @@ options.player.hurtsound.masculine=Masculine options.player.hurtsound.feminine=Feminine options.player.hurtsound.neutral=Neutral +options.hideHeldItemCount=Hide +options.hideDynamicTooltip=Hide +options.hideHealthBar=Hide +options.hideOxygenBar=Hide +options.hideFireBar=Hide +options.hideVehicleBar=Hide + +options.hideHelmetBar=Hide +options.hideHelmetBar.never=Never +options.hideHelmetBar.when_not_wearing=When Not Wearing +options.hideHelmetBar.always=Always + +options.hideChestplateBar=Hide +options.hideChestplateBar.never=Never +options.hideChestplateBar.when_not_wearing=When Not Wearing +options.hideChestplateBar.always=Always + +options.hideLeggingsBar=Hide +options.hideLeggingsBar.never=Never +options.hideLeggingsBar.when_not_wearing=When Not Wearing +options.hideLeggingsBar.always=Always + +options.hideBootsBar=Hide +options.hideBootsBar.never=Never +options.hideBootsBar.when_not_wearing=When Not Wearing +options.hideBootsBar.always=Always + +options.verticalHotBar=Vertical +options.verticalHeldItemCount=Vertical +options.verticalHealthBar=Vertical +options.verticalOxygenBar=Vertical +options.verticalVehicleBar=Vertical +options.verticalFireBar=Vertical + +options.flipHeldItemCount=Flip +options.flipHelmetBar=Flip +options.flipChestplateBar=Flip +options.flipLeggingsBar=Flip +options.flipBootsBar=Flip +options.flipHealthBar=Flip +options.flipOxygenBar=Flip +options.flipVehicleBar=Flip +options.flipFireBar=Flip + +options.horizontalInfoTextAlignment=Horizontal Alignment +options.horizontalInfoTextAlignment.left=Left +options.horizontalInfoTextAlignment.center=Center +options.horizontalInfoTextAlignment.right=Right + +options.horizontalLogTextAlignment=Horizontal Alignment +options.horizontalLogTextAlignment.left=Left +options.horizontalLogTextAlignment.center=Center +options.horizontalLogTextAlignment.right=Right + +options.verticalInfoTextAlignment=Vertical Alignment +options.verticalInfoTextAlignment.top=Top +options.verticalInfoTextAlignment.center=Center +options.verticalInfoTextAlignment.bottom=Bottom + +options.verticalLogTextAlignment=Vertical Alignment +options.verticalLogTextAlignment.top=Top +options.verticalLogTextAlignment.center=Center +options.verticalLogTextAlignment.bottom=Bottom + key.attack=Attack key.interact=Interact key.pickBlock=Pick Block @@ -314,13 +376,25 @@ key.autoWalk=Auto Walk key.easyBridge=Toggle Easy Bridge key.sprint=Sprint (if enabled) key.toggleDebug=Toggle Debug -key.toggleOverlay=Toggle Overlays +key.toggleInfoOverlay=Toggle Info Overlay key.sortInventory=Sort Inventory key.openAchievements=Open Achievements Menu key.openStatistics=Open Statistics Menu key.showConsole=Show Console key.description=Show item description key.disabled=Disabled + +key.hudEditorSelect=Select HUD Component +key.hudEditorOpenContext=Open Component Context Menu +key.hudEditorExit=Exit HUD Editor +key.hudEditorReset=Reset HUD to Default +key.hudEditorNudgeUp=Nudge Up Selected Component +key.hudEditorNudgeDown=Nudge Down Selected Component +key.hudEditorNudgeLeft=Nudge Left Selected Component +key.hudEditorNudgeRight=Nudge Right Selected Component +key.hudEditorNudgeFast=Nudge Selected Component Faster +key.hudEditorOnboarding=Show HUD Editor Onboarding Screen + key.debug.textureAtlas=Show Texture Atlas key.debug.textureAtlasLayer=Shift Texture Atlas Layer key.debug.reload=Reload textures