diff --git a/README.md b/README.md index 04c1df8..d88befd 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ Baubles ======= -A mod api that adds 4 bauble slots to the players inventory. +A mod api that adds 8 bauble slots to the players inventory. The mod has no real content - the idea is that other mods will use this one and its API to add their own baubles. -The 4 slots added are an amulet, belt and 2 ring slots. +The 8 slots added are an amulet, belt, head, body, charm, gauntlet and 2 ring slots. Baubles is distributed under the Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) license. diff --git a/src/main/java/baubles/api/BaubleType.java b/src/main/java/baubles/api/BaubleType.java index 22349ff..e899cb4 100644 --- a/src/main/java/baubles/api/BaubleType.java +++ b/src/main/java/baubles/api/BaubleType.java @@ -3,5 +3,9 @@ package baubles.api; public enum BaubleType { RING, AMULET, - BELT + BELT, + HEAD, + BODY, + CHARM, + GAUNTLET } diff --git a/src/main/java/baubles/client/gui/GuiPlayerExpanded.java b/src/main/java/baubles/client/gui/GuiPlayerExpanded.java index c36cc4e..e4f462b 100644 --- a/src/main/java/baubles/client/gui/GuiPlayerExpanded.java +++ b/src/main/java/baubles/client/gui/GuiPlayerExpanded.java @@ -69,7 +69,7 @@ public class GuiPlayerExpanded extends InventoryEffectRenderer { @Override protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { - this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 106, 16, 4210752); + this.fontRendererObj.drawString(I18n.format("container.crafting", new Object[0]), 104, 7, 4210752);//106 -> 104, 16 -> 7 } /** diff --git a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java index 04c741a..c3e5913 100644 --- a/src/main/java/baubles/common/container/ContainerPlayerExpanded.java +++ b/src/main/java/baubles/common/container/ContainerPlayerExpanded.java @@ -39,7 +39,7 @@ public class ContainerPlayerExpanded extends Container baubles.stackList = PlayerHandler.getPlayerBaubles(player).stackList; } - this.addSlotToContainer(new SlotCrafting(playerInv.player, this.craftMatrix, this.craftResult, 0, 144, 36)); + this.addSlotToContainer(new SlotCrafting(playerInv.player, this.craftMatrix, this.craftResult, 0, 144, 27));//36 -> 27 int i; int j; @@ -47,7 +47,7 @@ public class ContainerPlayerExpanded extends Container { for (j = 0; j < 2; ++j) { - this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 106 + j * 18, 26 + i * 18)); + this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 2, 106 + j * 18, 17 + i * 18));//26 -> 17 } } @@ -67,10 +67,14 @@ public class ContainerPlayerExpanded extends Container }); } - this.addSlotToContainer(new SlotBauble(baubles,BaubleType.AMULET,0,80,8 + 0 * 18)); - this.addSlotToContainer(new SlotBauble(baubles,BaubleType.RING,1,80,8 + 1 * 18)); - this.addSlotToContainer(new SlotBauble(baubles,BaubleType.RING,2,80,8 + 2 * 18)); - this.addSlotToContainer(new SlotBauble(baubles,BaubleType.BELT,3,80,8 + 3 * 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.AMULET, 0, 80, 8)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.RING,1, 80, 8 + 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.RING,2, 80, 8 + 2 * 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.BELT,3, 80, 8 + 3 * 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.HEAD,4, 80 + 18, 8 + 3 * 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.BODY,5, 80 + 18 * 2, 8 + 3 * 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.CHARM,6, 80 + 18 * 3, 8 + 3 * 18)); + this.addSlotToContainer(new SlotBauble(baubles,BaubleType.GAUNTLET,7, 80 + 18 * 4, 8 + 3 * 18)); for (i = 0; i < 3; ++i) { @@ -218,6 +222,50 @@ public class ContainerPlayerExpanded extends Container return null; } } + else if (itemstack.getItem() instanceof IBauble && + ((IBauble)itemstack.getItem()).getBaubleType(itemstack)==BaubleType.HEAD && + ((IBauble)itemstack.getItem()).canEquip(itemstack, thePlayer) && + !((Slot)this.inventorySlots.get(13)).getHasStack()) + { + int j = 13; + if (!this.mergeItemStack(itemstack1, j, j + 1, false)) + { + return null; + } + } + else if (itemstack.getItem() instanceof IBauble && + ((IBauble)itemstack.getItem()).getBaubleType(itemstack)==BaubleType.BODY && + ((IBauble)itemstack.getItem()).canEquip(itemstack, thePlayer) && + !((Slot)this.inventorySlots.get(14)).getHasStack()) + { + int j = 14; + if (!this.mergeItemStack(itemstack1, j, j + 1, false)) + { + return null; + } + } + else if (itemstack.getItem() instanceof IBauble && + ((IBauble)itemstack.getItem()).getBaubleType(itemstack)==BaubleType.CHARM && + ((IBauble)itemstack.getItem()).canEquip(itemstack, thePlayer) && + !((Slot)this.inventorySlots.get(15)).getHasStack()) + { + int j = 15; + if (!this.mergeItemStack(itemstack1, j, j + 1, false)) + { + return null; + } + } + else if (itemstack.getItem() instanceof IBauble && + ((IBauble)itemstack.getItem()).getBaubleType(itemstack)==BaubleType.GAUNTLET && + ((IBauble)itemstack.getItem()).canEquip(itemstack, thePlayer) && + !((Slot)this.inventorySlots.get(16)).getHasStack()) + { + int j = 16; + if (!this.mergeItemStack(itemstack1, j, j + 1, false)) + { + return null; + } + } else if (par2 >= 9+4 && par2 < 36+4) { if (!this.mergeItemStack(itemstack1, 36+4, 45+4, false)) diff --git a/src/main/java/baubles/common/container/InventoryBaubles.java b/src/main/java/baubles/common/container/InventoryBaubles.java index be34a45..1ce020e 100644 --- a/src/main/java/baubles/common/container/InventoryBaubles.java +++ b/src/main/java/baubles/common/container/InventoryBaubles.java @@ -25,7 +25,7 @@ public class InventoryBaubles implements IInventory { public boolean blockEvents=false; public InventoryBaubles(EntityPlayer player) { - this.stackList = new ItemStack[4]; + this.stackList = new ItemStack[8]; this.player = new WeakReference(player); } diff --git a/src/main/resources/assets/baubles/textures/gui/expanded_inventory - Copy.png b/src/main/resources/assets/baubles/textures/gui/expanded_inventory - Copy.png new file mode 100644 index 0000000..b6ce862 Binary files /dev/null and b/src/main/resources/assets/baubles/textures/gui/expanded_inventory - Copy.png differ diff --git a/src/main/resources/assets/baubles/textures/gui/expanded_inventory.png b/src/main/resources/assets/baubles/textures/gui/expanded_inventory.png index 3f24211..e3b0b43 100644 Binary files a/src/main/resources/assets/baubles/textures/gui/expanded_inventory.png and b/src/main/resources/assets/baubles/textures/gui/expanded_inventory.png differ diff --git a/src/main/resources/assets/baubles/textures/gui/expanded_inventory_old.png b/src/main/resources/assets/baubles/textures/gui/expanded_inventory_old.png new file mode 100644 index 0000000..3f24211 Binary files /dev/null and b/src/main/resources/assets/baubles/textures/gui/expanded_inventory_old.png differ