From 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 24 May 2018 16:03:42 -0400 Subject: Formatting pass --- .../gui/container/ContainerJewelryModifier.java | 17 ++- .../client/gui/container/ContainerJewelryTab.java | 125 +++++++++++++-------- .../client/gui/container/ContainerRingChest.java | 18 ++- .../client/gui/container/slots/SlotBracelet.java | 7 +- .../client/gui/container/slots/SlotEarrings.java | 7 +- .../client/gui/container/slots/SlotNecklace.java | 7 +- .../client/gui/container/slots/SlotRing.java | 7 +- 7 files changed, 117 insertions(+), 71 deletions(-) (limited to 'src/main/java/darkknight/jewelrycraft/client/gui/container') diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java index 652d628..975dbd2 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java @@ -10,15 +10,18 @@ import net.minecraft.item.ItemStack; public class ContainerJewelryModifier extends Container { public IInventory modInv; - public ContainerJewelryModifier(InventoryPlayer inv, IInventory mod) { + public ContainerJewelryModifier(InventoryPlayer inv, + IInventory mod) { int x, y; modInv = mod; for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x, 26 + 18 * x, 225)); + addSlotToContainer(new Slot(inv, x, 26 + 18 * x, + 225)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + y * 9, - 26 + 18 * x, 167 + y * 18)); + addSlotToContainer(new Slot(inv, + x + 9 + y * 9, 26 + 18 * x, + 167 + y * 18)); addSlotToContainer(new Slot(mod, 36, 37, 9)); } @@ -36,10 +39,12 @@ public class ContainerJewelryModifier extends Container { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 < 27) { - if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), + if (!mergeItemStack(itemstack1, 27, + inventorySlots.size(), true)) return null; - } else if (!mergeItemStack(itemstack1, 0, 27, false)) + } else if (!mergeItemStack(itemstack1, 0, 27, + false)) return null; if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null); diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java index 3061bfd..d3fbab1 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java @@ -23,25 +23,28 @@ public class ContainerJewelryTab extends Container { int x, y; // Rings for (x = 0; x <= 9; x++) - addSlotToContainer(new SlotRing(extra, x, 8 + x * 18, 7)); + addSlotToContainer(new SlotRing(extra, x, + 8 + x * 18, 7)); // Bracelets for (x = 10; x <= 13; x++) - addSlotToContainer( - new SlotBracelet(extra, x, 8 + (x - 10) * 18, 26)); + addSlotToContainer(new SlotBracelet(extra, x, + 8 + (x - 10) * 18, 26)); // Necklaces for (x = 14; x <= 16; x++) - addSlotToContainer( - new SlotNecklace(extra, x, 8 + (x - 14) * 18, 45)); + addSlotToContainer(new SlotNecklace(extra, x, + 8 + (x - 14) * 18, 45)); // Earrings addSlotToContainer(new SlotEarrings(extra, 17, 8, 64)); // Hotbar for (x = 0; x < 9; ++x) - addSlotToContainer(new Slot(inv, x, 17 + x * 18, 142)); + addSlotToContainer(new Slot(inv, x, 17 + x * 18, + 142)); // Inventory for (x = 0; x < 3; ++x) for (y = 0; y < 9; ++y) - addSlotToContainer(new Slot(inv, 9 + y + x * 9, - 17 + y * 18, 84 + x * 18)); + addSlotToContainer(new Slot(inv, + 9 + y + x * 9, 17 + y * 18, + 84 + x * 18)); } @Override @@ -52,36 +55,49 @@ public class ContainerJewelryTab extends Container { @Override public ItemStack slotClick(int slotID, int j, int k, EntityPlayer player) { - if (slotID >= 0 && slotID <= 17 && !player.worldObj.isRemote) { + if (slotID >= 0 && slotID <= 17 + && !player.worldObj.isRemote) { try { if (player.inventory.getItemStack() == null - && inventoryItemStacks.get(slotID) != null - && ((ItemStack) inventoryItemStacks.get(slotID)) - .getItem() instanceof ItemBaseJewelry) + && inventoryItemStacks.get( + slotID) != null + && ((ItemStack) inventoryItemStacks + .get(slotID)).getItem() instanceof ItemBaseJewelry) ((ItemBaseJewelry) ((ItemStack) inventoryItemStacks - .get(slotID)).getItem()).onJewelryUnequipped( - (ItemStack) inventoryItemStacks - .get(slotID)); - else if (player.inventory.getItemStack() != null - && player.inventory.getItemStack() + .get(slotID)).getItem()) + .onJewelryUnequipped( + (ItemStack) inventoryItemStacks + .get(slotID)); + else if (player.inventory + .getItemStack() != null + && player.inventory + .getItemStack() .getItem() instanceof ItemBaseJewelry - && inventoryItemStacks.get(slotID) == null) - ((ItemBaseJewelry) player.inventory.getItemStack() + && inventoryItemStacks.get( + slotID) == null) + ((ItemBaseJewelry) player.inventory + .getItemStack() .getItem()).onJewelryEquipped( player.inventory.getItemStack()); if (player.inventory.getItemStack() == null - && inventoryItemStacks.get(slotID) != null - && ((ItemStack) inventoryItemStacks.get(slotID)) - .getItem() instanceof IJewelryItem) + && inventoryItemStacks.get( + slotID) != null + && ((ItemStack) inventoryItemStacks + .get(slotID)).getItem() instanceof IJewelryItem) ((IJewelryItem) ((ItemStack) inventoryItemStacks - .get(slotID)).getItem()).onJewelryUnequipped( - (ItemStack) inventoryItemStacks - .get(slotID)); - else if (player.inventory.getItemStack() != null - && player.inventory.getItemStack() + .get(slotID)).getItem()) + .onJewelryUnequipped( + (ItemStack) inventoryItemStacks + .get(slotID)); + else if (player.inventory + .getItemStack() != null + && player.inventory + .getItemStack() .getItem() instanceof IJewelryItem - && inventoryItemStacks.get(slotID) == null) - ((IJewelryItem) player.inventory.getItemStack() + && inventoryItemStacks.get( + slotID) == null) + ((IJewelryItem) player.inventory + .getItemStack() .getItem()).onJewelryEquipped( player.inventory.getItemStack()); } catch (Exception e) { @@ -94,7 +110,8 @@ public class ContainerJewelryTab extends Container { } @Override - public ItemStack transferStackInSlot(EntityPlayer player, int slotID) { + public ItemStack transferStackInSlot(EntityPlayer player, + int slotID) { ItemStack itemstack = null; Slot slot = (Slot) inventorySlots.get(slotID); if (slot != null && slot.getHasStack()) { @@ -103,38 +120,52 @@ public class ContainerJewelryTab extends Container { if (slotID >= 18) { if (itemstack.getItem() instanceof ItemRing || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 0)) { - if (!mergeItemStack(itemstack, 0, 10, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 0)) { + if (!mergeItemStack(itemstack, 0, + 10, false) && !slot.getHasStack()) return null; - } else if (itemstack.getItem() instanceof ItemBracelet + } else if (itemstack + .getItem() instanceof ItemBracelet || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 1)) { - if (!mergeItemStack(itemstack, 10, 14, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 1)) { + if (!mergeItemStack(itemstack, 10, + 14, false) && !slot.getHasStack()) return null; - } else if (itemstack.getItem() instanceof ItemNecklace + } else if (itemstack + .getItem() instanceof ItemNecklace || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 2)) { - if (!mergeItemStack(itemstack, 14, 17, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 2)) { + if (!mergeItemStack(itemstack, 14, + 17, false) && !slot.getHasStack()) return null; - } else if (itemstack.getItem() instanceof ItemEarrings + } else if (itemstack + .getItem() instanceof ItemEarrings || (itemstack.getItem() instanceof IJewelryItem - && ((IJewelryItem) itemstack.getItem()) - .type() == 3)) { - if (!mergeItemStack(itemstack, 17, 18, false) + && ((IJewelryItem) itemstack + .getItem()).type() == 3)) { + if (!mergeItemStack(itemstack, 17, + 18, false) && !slot.getHasStack()) return null; } else { if (slotID < 27) { - if (!mergeItemStack(itemstack, 27, 36 + 18, false)) + if (!mergeItemStack( + itemstack, + 27, + 36 + 18, + false)) return null; } else { - if (!mergeItemStack(itemstack, 18, 27, false)) + if (!mergeItemStack( + itemstack, + 18, 27, + false)) return null; } } diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java index e848b38..825b737 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java @@ -15,20 +15,24 @@ public class ContainerRingChest extends Container { * @param inv * @param chest */ - public ContainerRingChest(InventoryPlayer inv, TileEntityChest chest) { + public ContainerRingChest(InventoryPlayer inv, + TileEntityChest chest) { theChest = chest; int x, y; for (x = 0; x < 9; x++) - addSlotToContainer(new SlotRingChest(inv, x, 8 + 18 * x, 142, + addSlotToContainer(new SlotRingChest(inv, x, + 8 + 18 * x, 142, x == inv.currentItem)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) - addSlotToContainer(new Slot(inv, x + 9 + y * 9, 8 + 18 * x, + addSlotToContainer(new Slot(inv, + x + 9 + y * 9, 8 + 18 * x, 84 + y * 18)); for (y = 0; y < 3; y++) for (x = 0; x < 9; x++) addSlotToContainer(new SlotRingChest(chest, - 26 - (x + y * 9), 8 + 18 * (8 - x), + 26 - (x + y * 9), + 8 + 18 * (8 - x), 17 + (2 - y) * 18, false)); } @@ -55,10 +59,12 @@ public class ContainerRingChest extends Container { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); if (par2 < 27) { - if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), + if (!mergeItemStack(itemstack1, 27, + inventorySlots.size(), true)) return null; - } else if (!mergeItemStack(itemstack1, 0, 27, false)) + } else if (!mergeItemStack(itemstack1, 0, 27, + false)) return null; if (itemstack1.stackSize == 0) slot.putStack((ItemStack) null); diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java index 2f3a9cc..ab09015 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java @@ -25,9 +25,10 @@ public class SlotBracelet extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemBracelet - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 1); + return stack.getItem() instanceof ItemBracelet || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 1); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java index c563f4d..1527e29 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java @@ -25,9 +25,10 @@ public class SlotEarrings extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemEarrings - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 3); + return stack.getItem() instanceof ItemEarrings || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 3); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java index ab2d04e..ba39329 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java @@ -25,9 +25,10 @@ public class SlotNecklace extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemNecklace - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 2); + return stack.getItem() instanceof ItemNecklace || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 2); } /** diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java index 6c16509..41381b1 100755 --- a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java +++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java @@ -25,9 +25,10 @@ public class SlotRing extends Slot { */ @Override public boolean isItemValid(ItemStack stack) { - return stack.getItem() instanceof ItemRing - || (stack.getItem() instanceof IJewelryItem - && ((IJewelryItem) stack.getItem()).type() == 0); + return stack.getItem() instanceof ItemRing || (stack + .getItem() instanceof IJewelryItem + && ((IJewelryItem) stack.getItem()) + .type() == 0); } /** -- cgit v1.2.3