isolate the oversized slots and itemhandlers

This commit is contained in:
PrototypeTrousers
2022-10-27 20:13:44 -03:00
parent 833f8aca2a
commit 53ed861e23
6 changed files with 162 additions and 105 deletions
@@ -28,8 +28,13 @@ import appeng.container.guisync.GuiSync;
import appeng.container.slot.*;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.AppEngInternalOversizedInventory;
import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.ItemStack;
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
@@ -62,10 +67,23 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
}
for (int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++) {
this.addSlotToContainer(new SlotNormal(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
this.addSlotToContainer(new SlotOversized(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
}
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
if (this.inventorySlots.get(slotId) instanceof SlotOversized) {
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(true);
ItemStack ret = super.slotClick(slotId, dragType, clickTypeIn, player);
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(false);
return ret;
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
@Override
protected int getHeight() {
return 256;