summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/client/gui/container
diff options
context:
space:
mode:
authorOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-04-12 16:29:24 +0300
committerOnyxDarkKnight <sor1n.iliutza16@gmail.com>2015-04-12 16:29:24 +0300
commit4f29b0ed24e393be7074abd851e207aadab38196 (patch)
treebe8e5211a2956589c08b5e88b5e083e6aaeb96ce /src/main/java/darkknight/jewelrycraft/client/gui/container
parent6312636fd9a4d0f56dc7c9ff474a99d879bcb4e9 (diff)
I rearranged files and added a few cool stuff.
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/client/gui/container')
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java27
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java50
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java91
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java64
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java52
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java52
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java52
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java52
-rw-r--r--src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java55
9 files changed, 495 insertions, 0 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java
new file mode 100644
index 0000000..ccb9ca9
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerGuide.java
@@ -0,0 +1,27 @@
+package darkknight.jewelrycraft.client.gui.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+
+/**
+ * User: joel / Date: 16.12.13 / Time: 22:36
+ */
+public class ContainerGuide extends Container
+{
+
+ /**
+ *
+ */
+ public ContainerGuide()
+ {}
+
+ /**
+ * @param entityplayer
+ * @return
+ */
+ @Override
+ public boolean canInteractWith(EntityPlayer entityplayer)
+ {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java
new file mode 100644
index 0000000..afb32d7
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryModifier.java
@@ -0,0 +1,50 @@
+package darkknight.jewelrycraft.client.gui.container;
+
+import net.minecraft.client.gui.GuiButton;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.JewelrycraftMod;
+import darkknight.jewelrycraft.client.gui.container.slots.SlotRing;
+
+public class ContainerJewelryModifier extends Container
+{
+ public IInventory modInv;
+ 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));
+ 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(mod, 36, 37, 9));
+ }
+
+ @Override
+ public boolean canInteractWith(EntityPlayer player)
+ {
+ return true;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
+ {
+ ItemStack itemstack = null;
+ Slot slot = (Slot)inventorySlots.get(par2);
+ if (slot != null && slot.getHasStack()){
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+ if (par2 < 27){
+ if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null;
+ }else if (!mergeItemStack(itemstack1, 0, 27, false)) return null;
+ if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null);
+ else slot.onSlotChanged();
+ }
+ return itemstack;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java
new file mode 100644
index 0000000..1b2ab60
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerJewelryTab.java
@@ -0,0 +1,91 @@
+package darkknight.jewelrycraft.client.gui.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.client.gui.container.slots.SlotBracelet;
+import darkknight.jewelrycraft.client.gui.container.slots.SlotEarrings;
+import darkknight.jewelrycraft.client.gui.container.slots.SlotNecklace;
+import darkknight.jewelrycraft.client.gui.container.slots.SlotRing;
+import darkknight.jewelrycraft.item.ItemBracelet;
+import darkknight.jewelrycraft.item.ItemEarrings;
+import darkknight.jewelrycraft.item.ItemNecklace;
+import darkknight.jewelrycraft.item.ItemRing;
+
+public class ContainerJewelryTab extends Container
+{
+
+ /**
+ * @param player
+ * @param inv
+ * @param extra
+ */
+ public ContainerJewelryTab(EntityPlayer player, IInventory inv, IInventory extra)
+ {
+ int x, y;
+ // Rings
+ for(x = 0; x <= 9; x++)
+ 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));
+ // Necklaces
+ for(x = 14; x <= 16; x++)
+ 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));
+ // 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));
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canInteractWith(EntityPlayer player)
+ {
+ return true;
+ }
+
+ /**
+ * @param player
+ * @param slotID
+ * @return
+ */
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
+ {
+ ItemStack itemstack = null;
+ Slot slot = (Slot)inventorySlots.get(slotID);
+ if (slot != null && slot.getHasStack()){
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+ if (slotID < 18){
+ if (!mergeItemStack(itemstack1, 18, 18 + 36, true)) return null;
+ slot.onSlotChange(itemstack1, itemstack);
+ }else if (itemstack1.getItem() instanceof ItemRing){
+ if (!mergeItemStack(itemstack1, 0, 10, false)) return null;
+ }else if (itemstack1.getItem() instanceof ItemBracelet){
+ if (!mergeItemStack(itemstack1, 10, 14, false)) return null;
+ }else if (itemstack1.getItem() instanceof ItemNecklace){
+ if (!mergeItemStack(itemstack1, 14, 17, false)) return null;
+ }else if (itemstack1.getItem() instanceof ItemEarrings){
+ if (!mergeItemStack(itemstack1, 17, 18, false)) return null;
+ }else{
+ if (!mergeItemStack(itemstack1, 18, 54, true)) return null;
+ slot.onSlotChange(itemstack1, itemstack);
+ }
+ if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null);
+ else slot.onSlotChanged();
+ }
+ return itemstack;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java
new file mode 100644
index 0000000..3d7beb6
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/ContainerRingChest.java
@@ -0,0 +1,64 @@
+package darkknight.jewelrycraft.client.gui.container;
+
+import darkknight.jewelrycraft.client.gui.container.slots.SlotRingChest;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntityChest;
+
+public class ContainerRingChest extends Container
+{
+ public TileEntityChest theChest;
+
+ /**
+ * @param inv
+ * @param 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, 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, 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), 17 + (2 - y) * 18, false));
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canInteractWith(EntityPlayer player)
+ {
+ return true;
+ }
+
+ /**
+ * @param par1EntityPlayer
+ * @param par2
+ * @return
+ */
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
+ {
+ ItemStack itemstack = null;
+ Slot slot = (Slot)inventorySlots.get(par2);
+ if (slot != null && slot.getHasStack()){
+ ItemStack itemstack1 = slot.getStack();
+ itemstack = itemstack1.copy();
+ if (par2 < 27){
+ if (!mergeItemStack(itemstack1, 27, inventorySlots.size(), true)) return null;
+ }else if (!mergeItemStack(itemstack1, 0, 27, false)) return null;
+ if (itemstack1.stackSize == 0) slot.putStack((ItemStack)null);
+ else slot.onSlotChanged();
+ }
+ return itemstack;
+ }
+}
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
new file mode 100644
index 0000000..3bdbb64
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotBracelet.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.client.gui.container.slots;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemBracelet;
+
+public class SlotBracelet extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotBracelet(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemBracelet;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
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
new file mode 100644
index 0000000..de062bc
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotEarrings.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.client.gui.container.slots;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemEarrings;
+
+public class SlotEarrings extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotEarrings(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemEarrings;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
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
new file mode 100644
index 0000000..9a64079
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotNecklace.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.client.gui.container.slots;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemNecklace;
+
+public class SlotNecklace extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotNecklace(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemNecklace;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
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
new file mode 100644
index 0000000..a52cf6b
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRing.java
@@ -0,0 +1,52 @@
+package darkknight.jewelrycraft.client.gui.container.slots;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import darkknight.jewelrycraft.item.ItemRing;
+
+public class SlotRing extends Slot
+{
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ */
+ public SlotRing(IInventory tile, int slotID, int x, int y)
+ {
+ super(tile, slotID, x, y);
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return stack.getItem() instanceof ItemRing;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ return super.decrStackSize(amount);
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return true;
+ }
+}
diff --git a/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java
new file mode 100644
index 0000000..8cc5431
--- /dev/null
+++ b/src/main/java/darkknight/jewelrycraft/client/gui/container/slots/SlotRingChest.java
@@ -0,0 +1,55 @@
+package darkknight.jewelrycraft.client.gui.container.slots;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class SlotRingChest extends Slot
+{
+ public boolean locked = false;
+
+ /**
+ * @param tile
+ * @param slotID
+ * @param x
+ * @param y
+ * @param locked
+ */
+ public SlotRingChest(IInventory tile, int slotID, int x, int y, boolean locked)
+ {
+ super(tile, slotID, x, y);
+ this.locked = locked;
+ }
+
+ /**
+ * @param stack
+ * @return
+ */
+ @Override
+ public boolean isItemValid(ItemStack stack)
+ {
+ return !locked;
+ }
+
+ /**
+ * @param amount
+ * @return
+ */
+ @Override
+ public ItemStack decrStackSize(int amount)
+ {
+ if (!locked) return super.decrStackSize(amount);
+ return null;
+ }
+
+ /**
+ * @param player
+ * @return
+ */
+ @Override
+ public boolean canTakeStack(EntityPlayer player)
+ {
+ return !locked;
+ }
+}