diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index 1dcc4148..139dee62 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -210,8 +210,12 @@ public abstract class GuiContainer extends Gui Drawing.drawGradient(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, width * this.container_scale, height * this.container_scale, 0xff000000 | top, 0xff000000 | bottom, 0xff000000 | topleft, 0xff000000 | btmright); } + public InventoryButton slot(int x, int y, int w, int h, Slot slot) { + return this.add(new InventoryButton(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, w * this.container_scale, h * this.container_scale, this.container_scale > 1, slot)); + } + public InventoryButton slot(int x, int y, int w, int h) { - return this.add(new InventoryButton(this.container_x + x * this.container_scale, this.container_y + y * this.container_scale, w * this.container_scale, h * this.container_scale, this.container_scale > 1)); + return this.slot(x, y, w, h, null); } public ActButton button(int x, int y, int w, int h, ButtonCallback callback, String text) { @@ -276,8 +280,8 @@ public abstract class GuiContainer extends Gui public void addButtons() { if(this.inventorySlots != null) { for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) { - Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1); - this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18); + Slot slot = this.inventorySlots.inventorySlots.get(i1); + this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot); } } if(this.gm.itemCheat) { @@ -286,7 +290,7 @@ public abstract class GuiContainer extends Gui this.cheatSearch = this.add(new Field(this.cheatX, this.cheatY + this.cheatHeight * 18 + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 4, this.cheatWidth * 18, 0, 128, null, "")); this.cheatLast = ""; for(CheatTab tab : CheatTab.values()) { - this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, false)); + this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, false, null)); } this.setCurrentTab(selectedTab); } diff --git a/client/src/main/java/client/gui/element/InventoryButton.java b/client/src/main/java/client/gui/element/InventoryButton.java index 554f1274..ebcbb6a5 100644 --- a/client/src/main/java/client/gui/element/InventoryButton.java +++ b/client/src/main/java/client/gui/element/InventoryButton.java @@ -1,17 +1,26 @@ package client.gui.element; import client.renderer.Drawing; +import common.inventory.Slot; public class InventoryButton extends Element { private final boolean bordered; + private final Slot slot; + private final String texture; - public InventoryButton(int x, int y, int w, int h, boolean bordered) { + public InventoryButton(int x, int y, int w, int h, boolean bordered, Slot slot) { super(x, y, w, h, null); this.bordered = bordered; + this.texture = slot == null || slot.getTexture() == null ? null : "textures/items/icon_" + slot.getTexture() + ".png"; + this.slot = this.texture == null ? null : slot; } protected void drawBackground() { drawButton(this.pos_x, this.pos_y, this.size_x, this.size_y, this.bordered); + if(this.texture != null && !this.slot.getHasStack()) { + int scale = this.bordered ? 2 : 1; + Drawing.drawTexturedRect(this.gm, this.texture, 16 * scale, 16 * scale, this.pos_x + scale, this.pos_y + scale, 0, 0, this.size_x - scale * 2, this.size_y - scale * 2); + } } protected void drawForeground(int x1, int y1, int x2, int y2) { diff --git a/client/src/main/resources/textures/items/icon_belt.png b/client/src/main/resources/textures/items/icon_belt.png new file mode 100755 index 00000000..07e3b197 Binary files /dev/null and b/client/src/main/resources/textures/items/icon_belt.png differ diff --git a/client/src/main/resources/textures/items/icon_boots.png b/client/src/main/resources/textures/items/icon_boots.png new file mode 100755 index 00000000..d85cce06 Binary files /dev/null and b/client/src/main/resources/textures/items/icon_boots.png differ diff --git a/client/src/main/resources/textures/items/icon_chestplate.png b/client/src/main/resources/textures/items/icon_chestplate.png new file mode 100755 index 00000000..f1c21ced Binary files /dev/null and b/client/src/main/resources/textures/items/icon_chestplate.png differ diff --git a/client/src/main/resources/textures/items/icon_crown.png b/client/src/main/resources/textures/items/icon_crown.png new file mode 100755 index 00000000..98db7d62 Binary files /dev/null and b/client/src/main/resources/textures/items/icon_crown.png differ diff --git a/client/src/main/resources/textures/items/icon_helmet.png b/client/src/main/resources/textures/items/icon_helmet.png new file mode 100755 index 00000000..d3f382b0 Binary files /dev/null and b/client/src/main/resources/textures/items/icon_helmet.png differ diff --git a/client/src/main/resources/textures/items/icon_leggings.png b/client/src/main/resources/textures/items/icon_leggings.png new file mode 100755 index 00000000..540649a7 Binary files /dev/null and b/client/src/main/resources/textures/items/icon_leggings.png differ diff --git a/client/src/main/resources/textures/items/icon_necklace.png b/client/src/main/resources/textures/items/icon_necklace.png new file mode 100755 index 00000000..a46a8b9a Binary files /dev/null and b/client/src/main/resources/textures/items/icon_necklace.png differ diff --git a/client/src/main/resources/textures/items/icon_ring.png b/client/src/main/resources/textures/items/icon_ring.png new file mode 100755 index 00000000..a8ef1243 Binary files /dev/null and b/client/src/main/resources/textures/items/icon_ring.png differ diff --git a/client/src/main/resources/textures/items/icon_shield.png b/client/src/main/resources/textures/items/icon_shield.png new file mode 100755 index 00000000..145b6cff Binary files /dev/null and b/client/src/main/resources/textures/items/icon_shield.png differ diff --git a/common/src/main/java/common/inventory/ContainerPlayer.java b/common/src/main/java/common/inventory/ContainerPlayer.java index 00064d97..8c921f48 100755 --- a/common/src/main/java/common/inventory/ContainerPlayer.java +++ b/common/src/main/java/common/inventory/ContainerPlayer.java @@ -46,6 +46,9 @@ public class ContainerPlayer extends Container { { return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(type); } + public String getTexture() { + return type.isRing() ? "ring" : type.getName(); + } }); } diff --git a/common/src/main/java/common/inventory/Slot.java b/common/src/main/java/common/inventory/Slot.java index 7800ca50..a4b171e2 100755 --- a/common/src/main/java/common/inventory/Slot.java +++ b/common/src/main/java/common/inventory/Slot.java @@ -122,10 +122,10 @@ public class Slot return this.getSlotStackLimit(); } -// public String getSlotTexture() -// { -// return null; -// } + public String getTexture() + { + return null; + } /** * Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new diff --git a/common/src/main/java/common/util/Equipment.java b/common/src/main/java/common/util/Equipment.java index 7168376a..05b63e24 100644 --- a/common/src/main/java/common/util/Equipment.java +++ b/common/src/main/java/common/util/Equipment.java @@ -19,12 +19,12 @@ public enum Equipment implements Identifyable, Displayable { BOOTS("boots", "Stiefel", "Stiefel", 13, 3, EnchantmentType.ARMOR_FEET, 1.4f, 1.0f, "X X", "X X"), CROWN("crown", "Krone", 0, 4, null, 0.3f, 1.0f), - RING_LEFT_A("ring_left_A", "Linker Ring 1", 0, 5, EnchantmentType.RING, 1.0f), + RING_LEFT_A("ring_left_a", "Linker Ring 1", 0, 5, EnchantmentType.RING, 1.0f), RING_LEFT_B("ring_left_b", "Linker Ring 2", 0, 6, EnchantmentType.RING, 1.0f), SHIELD("shield", "Schild", 12, 7, EnchantmentType.SHIELD, 0.7f, 1.0f), NECKLACE("necklace", "Halskette", 0, 8, EnchantmentType.NECKLACE, 1.0f), RING_RIGHT_A("ring_right_a", "Rechter Ring 1", 0, 9, EnchantmentType.RING, 1.0f), - RING_RIGHT_B("ring_right_a", "Rechter Ring 2", 0, 10, EnchantmentType.RING, 1.0f), + RING_RIGHT_B("ring_right_b", "Rechter Ring 2", 0, 10, EnchantmentType.RING, 1.0f), BELT("belt", "Gürtel", 0, 11, null, 1.0f), HORSE_ARMOR("horse_armor", "Pferderüstung", EntityHorse.class, "X X", "XXX", "XXX");