add armor slot textures
|
@ -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);
|
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) {
|
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) {
|
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() {
|
public void addButtons() {
|
||||||
if(this.inventorySlots != null) {
|
if(this.inventorySlots != null) {
|
||||||
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
|
for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) {
|
||||||
Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1);
|
Slot slot = this.inventorySlots.inventorySlots.get(i1);
|
||||||
this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18);
|
this.slot(slot.xDisplayPosition - 1, slot.yDisplayPosition - 1, 18, 18, slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(this.gm.itemCheat) {
|
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.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 = "";
|
this.cheatLast = "";
|
||||||
for(CheatTab tab : CheatTab.values()) {
|
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);
|
this.setCurrentTab(selectedTab);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,26 @@
|
||||||
package client.gui.element;
|
package client.gui.element;
|
||||||
|
|
||||||
import client.renderer.Drawing;
|
import client.renderer.Drawing;
|
||||||
|
import common.inventory.Slot;
|
||||||
|
|
||||||
public class InventoryButton extends Element {
|
public class InventoryButton extends Element {
|
||||||
private final boolean bordered;
|
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);
|
super(x, y, w, h, null);
|
||||||
this.bordered = bordered;
|
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() {
|
protected void drawBackground() {
|
||||||
drawButton(this.pos_x, this.pos_y, this.size_x, this.size_y, this.bordered);
|
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) {
|
protected void drawForeground(int x1, int y1, int x2, int y2) {
|
||||||
|
|
BIN
client/src/main/resources/textures/items/icon_belt.png
Executable file
After Width: | Height: | Size: 5.5 KiB |
BIN
client/src/main/resources/textures/items/icon_boots.png
Executable file
After Width: | Height: | Size: 5.5 KiB |
BIN
client/src/main/resources/textures/items/icon_chestplate.png
Executable file
After Width: | Height: | Size: 5.4 KiB |
BIN
client/src/main/resources/textures/items/icon_crown.png
Executable file
After Width: | Height: | Size: 5.2 KiB |
BIN
client/src/main/resources/textures/items/icon_helmet.png
Executable file
After Width: | Height: | Size: 5.2 KiB |
BIN
client/src/main/resources/textures/items/icon_leggings.png
Executable file
After Width: | Height: | Size: 5.4 KiB |
BIN
client/src/main/resources/textures/items/icon_necklace.png
Executable file
After Width: | Height: | Size: 5.5 KiB |
BIN
client/src/main/resources/textures/items/icon_ring.png
Executable file
After Width: | Height: | Size: 5.5 KiB |
BIN
client/src/main/resources/textures/items/icon_shield.png
Executable file
After Width: | Height: | Size: 5.4 KiB |
|
@ -46,6 +46,9 @@ public class ContainerPlayer extends Container {
|
||||||
{
|
{
|
||||||
return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(type);
|
return stack != null && stack.getItem() instanceof ItemArmor armor && armor.getArmorType().canUseInSlot(type);
|
||||||
}
|
}
|
||||||
|
public String getTexture() {
|
||||||
|
return type.isRing() ? "ring" : type.getName();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,10 +122,10 @@ public class Slot
|
||||||
return this.getSlotStackLimit();
|
return this.getSlotStackLimit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// public String getSlotTexture()
|
public String getTexture()
|
||||||
// {
|
{
|
||||||
// return null;
|
return null;
|
||||||
// }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
|
* Decrease the size of the stack in slot (first int arg) by the amount of the second int arg. Returns the new
|
||||||
|
|
|
@ -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"),
|
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),
|
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),
|
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),
|
SHIELD("shield", "Schild", 12, 7, EnchantmentType.SHIELD, 0.7f, 1.0f),
|
||||||
NECKLACE("necklace", "Halskette", 0, 8, EnchantmentType.NECKLACE, 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_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),
|
BELT("belt", "Gürtel", 0, 11, null, 1.0f),
|
||||||
|
|
||||||
HORSE_ARMOR("horse_armor", "Pferderüstung", EntityHorse.class, "X X", "XXX", "XXX");
|
HORSE_ARMOR("horse_armor", "Pferderüstung", EntityHorse.class, "X X", "XXX", "XXX");
|
||||||
|
|