net.minecraftforge.items.SlotItemHandler Java Examples
The following examples show how to use
net.minecraftforge.items.SlotItemHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContainerCreationStation.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected int getMaxStackSizeFromSlotAndStack(Slot slot, ItemStack stack) { // Our main item inventory or the furnace inventory if (slot instanceof SlotItemHandler) { SlotItemHandler slotItemHandler = (SlotItemHandler) slot; if (slotItemHandler.getItemHandler() == this.inventory || slotItemHandler.getItemHandler() == this.tecs.getFurnaceInventory()) { return slotItemHandler.getItemStackLimit(stack); } } // Player inventory, module slots or crafting slots return super.getMaxStackSizeFromSlotAndStack(slot, stack); }
Example #2
Source File: SawmillContainer.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 6 votes |
public SawmillContainer(int windowId, PlayerInventory playerInventory, IItemHandlerModifiable inventory, IIntArray dryTimes) { super(TYPE, windowId); fields = dryTimes; wrappedInventory = new ChoppingContext(inventory, null, 0, 0, RANDOM); world = playerInventory.player.world; addSlot(new SlotItemHandler(inventory, 0, 56, 17)); addSlot(new SawmillFuelSlot(inventory, 1, 56, 53)); addSlot(new SawmillOutputSlot(inventory, 2, 116, 35)); bindPlayerInventory(playerInventory); trackIntArray(fields); }
Example #3
Source File: ModificationTableContainer.java From MiningGadgets with MIT License | 5 votes |
private int addSlotRange(IItemHandler handler, int index, int x, int y, int amount, int dx) { for (int i = 0; i < amount; i++) { addSlot(new SlotItemHandler(handler, index, x, y)); x += dx; index++; } return index; }
Example #4
Source File: ContainerBackpack.java From WearableBackpacks with MIT License | 5 votes |
protected void setupBackpackSlots() { int xOffset = 1 + getContainerInvXOffset(); int yOffset = 1 + getBorderTop(); for (int y = 0; y < size.getRows(); y++, yOffset += 18) for (int x = 0; x < size.getColumns(); x++) addSlotToContainer(new SlotItemHandler(items, x + y * size.getColumns(), xOffset + x * 18, yOffset)); }
Example #5
Source File: ContainerEnderUtilities.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean canMergeSlot(ItemStack stack, Slot slot) { return (slot instanceof SlotItemHandler) && (slot instanceof SlotItemHandlerCraftResult) == false && (slot instanceof SlotItemHandlerFurnaceOutput) == false && this.inventoryPlayer.getItemStack().isEmpty() == false; }
Example #6
Source File: ContainerLargeStacks.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected int getMaxStackSizeFromSlotAndStack(Slot slot, ItemStack stack) { // Our inventory if (slot instanceof SlotItemHandler && ((SlotItemHandler) slot).getItemHandler() == this.inventory) { return slot.getItemStackLimit(stack); } // Player inventory return super.getMaxStackSizeFromSlotAndStack(slot, stack); }
Example #7
Source File: DryingRackContainer.java From Survivalist with BSD 3-Clause "New" or "Revised" License | 5 votes |
private DryingRackContainer(int windowId, PlayerInventory playerInventory, IItemHandler inventory, IIntArray dryTimes) { super(TYPE, windowId); dryTimeRemainingArray = dryTimes; addSlot(new SlotItemHandler(inventory, 0, 26, 34)); addSlot(new SlotItemHandler(inventory, 1, 62, 34)); addSlot(new SlotItemHandler(inventory, 2, 98, 34)); addSlot(new SlotItemHandler(inventory, 3, 134, 34)); bindPlayerInventory(playerInventory, 84); this.trackIntArray(dryTimeRemainingArray); }
Example #8
Source File: ContainerBlueprintArchive.java From Cyberware with MIT License | 5 votes |
public ContainerBlueprintArchive(IInventory playerInventory, TileEntityBlueprintArchive archive) { this.archive = archive; this.numRows = archive.slots.getSlots() / 9; int i = (this.numRows - 4) * 18; for (int j = 0; j < this.numRows; ++j) { for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new SlotItemHandler(archive.slots, k + j * 9, 8 + k * 18, 18 + j * 18)); } } for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { this.addSlotToContainer(new Slot(playerInventory, j1 + l * 9 + 9, 8 + j1 * 18, 103 + l * 18 + i)); } } for (int i1 = 0; i1 < 9; ++i1) { this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 161 + i)); } }
Example #9
Source File: ContainerComponentBox.java From Cyberware with MIT License | 5 votes |
public ContainerComponentBox(IInventory playerInventory, ItemStack itemStack) { this.box = null; this.item = itemStack; slots = new ItemStackHandlerComponent(18); if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey("contents")) { slots.deserializeNBT(itemStack.getTagCompound().getCompoundTag("contents")); } this.numRows = slots.getSlots() / 9; int i = (this.numRows - 4) * 18; for (int j = 0; j < this.numRows; ++j) { for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new SlotItemHandler(slots, k + j * 9, 8 + k * 18, 18 + j * 18)); } } for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { this.addSlotToContainer(new Slot(playerInventory, j1 + l * 9 + 9, 8 + j1 * 18, 103 + l * 18 + i)); } } for (int i1 = 0; i1 < 9; ++i1) { this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 161 + i)); } }
Example #10
Source File: ContainerComponentBox.java From Cyberware with MIT License | 5 votes |
public ContainerComponentBox(IInventory playerInventory, TileEntityComponentBox box) { this.box = box; this.item = null; this.slots = box.slots; this.numRows = slots.getSlots() / 9; int i = (this.numRows - 4) * 18; for (int j = 0; j < this.numRows; ++j) { for (int k = 0; k < 9; ++k) { this.addSlotToContainer(new SlotItemHandler(slots, k + j * 9, 8 + k * 18, 18 + j * 18)); } } for (int l = 0; l < 3; ++l) { for (int j1 = 0; j1 < 9; ++j1) { this.addSlotToContainer(new Slot(playerInventory, j1 + l * 9 + 9, 8 + j1 * 18, 103 + l * 18 + i)); } } for (int i1 = 0; i1 < 9; ++i1) { this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 161 + i)); } }
Example #11
Source File: ContainerFloader.java From YouTubeModdingTutorial with MIT License | 5 votes |
private void addOwnSlots() { IItemHandler itemHandler = this.te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); int x = 10; int y = 26; int slotIndex = 0; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex, x, y)); }
Example #12
Source File: ContainerSuperchest.java From YouTubeModdingTutorial with MIT License | 5 votes |
private void addOwnSlots() { IItemHandler itemHandler = this.te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); int slotIndex = 0; for (int row = 0; row < 3; ++row) { for (int col = 0; col < 9; ++col) { int x = 10 + col * 18; int y = row * 18 + 8; this.addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); } } }
Example #13
Source File: ContainerFastFurnace.java From YouTubeModdingTutorial with MIT License | 5 votes |
private void addOwnSlots() { IItemHandler itemHandler = this.te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null); int x = 10; int y = 26; int slotIndex = 0; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x = 118; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); x += 18; addSlotToContainer(new SlotItemHandler(itemHandler, slotIndex++, x, y)); }
Example #14
Source File: FilterContainer.java From MiningGadgets with MIT License | 5 votes |
private int addSlotRange(IItemHandler handler, int index, int x, int y, int amount, int dx) { for (int i = 0; i < amount; i++) { addSlot(new SlotItemHandler(handler, index, x, y)); x += dx; index++; } return index; }
Example #15
Source File: CollectorContainer.java From EmergingTechnology with MIT License | 5 votes |
@Override public void addMachineSlots(IItemHandler handler) { this.addSlotToContainer(new SlotItemHandler(handler, 0, 22, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 1, 50, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 2, 78, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 3, 106, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 4, 134, 35)); }
Example #16
Source File: HarvesterContainer.java From EmergingTechnology with MIT License | 5 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 52, 35)); addSlotToContainer(new SlotItemHandler(handler, 2, 80, 35)); addSlotToContainer(new SlotItemHandler(handler, 3, 108, 35)); }
Example #17
Source File: BiomassGeneratorContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); }
Example #18
Source File: OptimiserContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); }
Example #19
Source File: GuiContainerLargeStacks.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void drawSlot(Slot slotIn) { int slotPosX = slotIn.xPos; int slotPosY = slotIn.yPos; ItemStack stack = slotIn.getStack(); boolean flag = false; boolean flag1 = slotIn == this.clickedSlot && this.draggedStack.isEmpty() == false && this.isRightMouseClick == false; ItemStack stackCursor = this.mc.player.inventory.getItemStack(); String str = null; if (slotIn == this.clickedSlot && this.draggedStack.isEmpty() == false && this.isRightMouseClick && stack.isEmpty() == false) { stack = stack.copy(); stack.setCount(stack.getCount() / 2); } else if (this.dragSplitting && this.dragSplittingSlots.contains(slotIn) && stackCursor.isEmpty() == false) { if (this.dragSplittingSlots.size() == 1) { return; } if (Container.canAddItemToSlot(slotIn, stackCursor, true) && this.inventorySlots.canDragIntoSlot(slotIn)) { stack = stackCursor.copy(); flag = true; Container.computeStackSize(this.dragSplittingSlots, this.dragSplittingLimit, stack, slotIn.getStack().getCount()); if (stack.getCount() > stack.getMaxStackSize()) { str = TextFormatting.YELLOW + "" + stack.getMaxStackSize(); stack.setCount(stack.getMaxStackSize()); } if (stack.getCount() > slotIn.getItemStackLimit(stack)) { str = TextFormatting.YELLOW + "" + slotIn.getItemStackLimit(stack); stack.setCount(slotIn.getItemStackLimit(stack)); } } else { this.dragSplittingSlots.remove(slotIn); this.updateDragSplitting(); } } this.zLevel = 100.0F; this.itemRender.zLevel = 100.0F; if (stack.isEmpty()) { TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite(); if (textureatlassprite != null) { GlStateManager.disableLighting(); this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation()); this.drawTexturedModalRect(slotPosX, slotPosY, textureatlassprite, 16, 16); GlStateManager.enableLighting(); flag1 = true; } } if (flag1 == false) { if (flag) { drawRect(slotPosX, slotPosY, slotPosX + 16, slotPosY + 16, -2130706433); } GlStateManager.enableDepth(); this.itemRender.renderItemAndEffectIntoGUI(stack, slotPosX, slotPosY); // This slot belongs to a "large stacks" type inventory, render the stack size text scaled to 0.5x if (slotIn instanceof SlotItemHandler && this.scaledStackSizeTextInventories.contains(((SlotItemHandler) slotIn).getItemHandler())) { this.renderLargeStackItemOverlayIntoGUI(this.fontRenderer, stack, slotPosX, slotPosY); } else { this.itemRender.renderItemOverlayIntoGUI(this.fontRenderer, stack, slotPosX, slotPosY, str); } } this.itemRender.zLevel = 0.0F; this.zLevel = 0.0F; }
Example #20
Source File: ScrubberContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); }
Example #21
Source File: ScaffolderContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { this.addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 2, 80, 72)); }
Example #22
Source File: FabricatorContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { this.addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); this.addSlotToContainer(new SlotItemHandler(handler, 1, 123, 35)); }
Example #23
Source File: BioreactorContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); }
Example #24
Source File: DiffuserContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); }
Example #25
Source File: AlgaeBioreactorContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); }
Example #26
Source File: LightContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); }
Example #27
Source File: ProcessorContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); }
Example #28
Source File: InjectorContainer.java From EmergingTechnology with MIT License | 4 votes |
@Override public void addMachineSlots(IItemHandler handler) { addSlotToContainer(new SlotItemHandler(handler, 0, 17, 35)); addSlotToContainer(new SlotItemHandler(handler, 1, 80, 35)); }
Example #29
Source File: SlotWidget.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
@Override public final SlotItemHandler getHandle() { return slotReference; }
Example #30
Source File: SlotWidget.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
protected SlotItemHandler createSlot(IItemHandler itemHandler, int index) { return new WidgetSlotDelegate(itemHandler, index, 0, 0); }