diff --git a/src/main/java/com/enderio/core/client/gui/widget/GhostBackgroundItemSlot.java b/src/main/java/com/enderio/core/client/gui/widget/GhostBackgroundItemSlot.java index f55bffea..d22dd420 100644 --- a/src/main/java/com/enderio/core/client/gui/widget/GhostBackgroundItemSlot.java +++ b/src/main/java/com/enderio/core/client/gui/widget/GhostBackgroundItemSlot.java @@ -60,7 +60,7 @@ public void putStack(ItemStack stack) { @Override public boolean isVisible() { - return parent != null ? parent.xDisplayPosition >= 0 && parent.yDisplayPosition >= 0 : super.isVisible(); + return parent != null ? parent.xDisplayPosition >= 0 && parent.yDisplayPosition >= 0 && !parent.getHasStack() && super.isVisible() : super.isVisible(); } -} \ No newline at end of file +} diff --git a/src/main/java/com/enderio/core/common/ContainerEnder.java b/src/main/java/com/enderio/core/common/ContainerEnder.java index 345ddf9a..8237ab96 100644 --- a/src/main/java/com/enderio/core/common/ContainerEnder.java +++ b/src/main/java/com/enderio/core/common/ContainerEnder.java @@ -18,10 +18,10 @@ public class ContainerEnder extends Container { protected Map playerSlotLocations = Maps.newLinkedHashMap(); - protected final int startPlayerSlot; - protected final int endPlayerSlot; - protected final int startHotBarSlot; - protected final int endHotBarSlot; + protected int startPlayerSlot; + protected int endPlayerSlot; + protected int startHotBarSlot; + protected int endHotBarSlot; private final @Nonnull T inv; private final @Nonnull InventoryPlayer playerInv; @@ -38,6 +38,24 @@ public ContainerEnder(InventoryPlayer playerInv, T inv) { this.inv = checkNotNull(inv); this.playerInv = checkNotNull(playerInv); + init(); + } + + /** + * Use this constructor if you need a fully initialized object for your + * addSlots(), e.g. because you need to pass your slots on to your + * createGhostSlots(). You must call init() in your constructor. + */ + public ContainerEnder(boolean iPromiseToCallInitInTheImplementationClassConstructor, InventoryPlayer playerInv, T inv) { + this.inv = checkNotNull(inv); + this.playerInv = checkNotNull(playerInv); + + if (!iPromiseToCallInitInTheImplementationClassConstructor) { + init(); + } + } + + protected void init() { addSlots(playerInv); int x = getPlayerInventoryOffset().x;