From 0ecc4872ffaa5e0ebd77ac5d94f873c97921a79a Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Sun, 6 Sep 2015 01:21:34 +0100 Subject: [PATCH] Fixed a flower dupe with the Flower Pouch. Closes #1348 --- .../client/gui/bag/ContainerFlowerBag.java | 8 +++-- .../botania/client/gui/bag/SlotLocked.java | 34 +++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 src/main/java/vazkii/botania/client/gui/bag/SlotLocked.java diff --git a/src/main/java/vazkii/botania/client/gui/bag/ContainerFlowerBag.java b/src/main/java/vazkii/botania/client/gui/bag/ContainerFlowerBag.java index effca93a5..6695d4a9e 100644 --- a/src/main/java/vazkii/botania/client/gui/bag/ContainerFlowerBag.java +++ b/src/main/java/vazkii/botania/client/gui/bag/ContainerFlowerBag.java @@ -38,8 +38,12 @@ public class ContainerFlowerBag extends Container { for(j = 0; j < 9; ++j) addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); - for(i = 0; i < 9; ++i) - addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142)); + for(i = 0; i < 9; ++i) { + if(player.inventory.currentItem == i) + addSlotToContainer(new SlotLocked(playerInv, i, 8 + i * 18, 142)); + else addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 142)); + } + } @Override diff --git a/src/main/java/vazkii/botania/client/gui/bag/SlotLocked.java b/src/main/java/vazkii/botania/client/gui/bag/SlotLocked.java new file mode 100644 index 000000000..66962711d --- /dev/null +++ b/src/main/java/vazkii/botania/client/gui/bag/SlotLocked.java @@ -0,0 +1,34 @@ +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under the + * Botania License: http://botaniamod.net/license.php + * + * File Created @ [Sep 6, 2015, 1:11:25 AM (GMT)] + */ +package vazkii.botania.client.gui.bag; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotLocked extends Slot { + + public SlotLocked(IInventory p_i1824_1_, int p_i1824_2_, int p_i1824_3_, int p_i1824_4_) { + super(p_i1824_1_, p_i1824_2_, p_i1824_3_, p_i1824_4_); + } + + @Override + public boolean canTakeStack(EntityPlayer p_82869_1_) { + return false; + } + + @Override + public boolean isItemValid(ItemStack p_75214_1_) { + return false; + } + +}