@Override public boolean isLiquidValidForTank(final FluidStack liquid, final int index) { final TankSlot slot = this.getTankSlot(index); return slot != null && (slot.isValid(liquid) && !slot.isReadOnly()); }
@Override public boolean isItemValidForSlot(final int index, final ItemStack itemStack) { InventorySlot slot = this.getSlot(index); return slot != null && (slot.isValid(itemStack) && !this.isReadOnly(index)); }
@Override public boolean canInsertItem(final int index, final ItemStack itemstack, final EnumFacing direction) { if (!isItemValidForSlot(index, itemstack)) { return false; } InventorySlot slot = this.getSlot(index); return slot != null && slot.canInsert(direction); }
@Override public ItemStack removeStackFromSlot(int index) { InventorySlot slot = getInternalSlot(index); if (slot.isFake()) { return ItemStack.EMPTY; } ItemStack content = slot.getItemStack(); slot.setContent(ItemStack.EMPTY); this.markDirty(); return content; }
public void setType(final Type type) { this.type = type; if (type == Type.Recipe) { //this.setReadOnly(); this.forbidInteraction(); } }
@Override public ItemStack decrStackSize(final int index, final int amount) { InventorySlot slot = getInternalSlot(index); ItemStack stack = slot.decrStackSize(amount); if (!stack.isEmpty()) { this.markDirty(); } return stack; }
public BaseSlot(final int index, final ResourceLocation unlocLocation) { this.access = new SidedAccess(); this.setIndex(index); this.unlocLocation = unlocLocation; }
@Override public boolean canExtractItem(final int index, final ItemStack itemstack, final EnumFacing direction) { InventorySlot slot = this.getSlot(index); return slot != null && slot.canExtract(direction); }
private boolean isReadOnly(final int slot) { final InventorySlot iSlot = this.getSlot(slot); return iSlot == null || iSlot.isReadOnly(); }
public void setExtract(boolean value) { if (this.base.canExtract() != value) { this.base = this.base.changeExtract(value); } } }
public void forbidInteraction() { this.readOnly = true; this.forbidInsertion(); this.forbidExtraction(); }
public final void transfer(final IInventory inv) { if (this.condition == null || this.fulfilled(inv)) { this.doTransfer(inv); } }
public void setInsert(boolean value) { if (this.base.canInsert() != value) { this.base = this.base.changeInsert(value); } }
@Override public String getName() { Validator<FluidStack> validator = getValidator(); if (validator != null) { return I18N.localise(ModId.CORE, "gui.tank.validated", validator.getTooltip()); } if (this.unlocLocation == null) { return ""; } return I18N.localise(this.unlocLocation); } }
@Override public String getName() { SlotValidator validator = getValidator(); if (validator != null) { return I18N.localise(ModId.CORE, "gui.slot.validated", validator.getTooltip()); } if (this.unlocLocation == null) { return ""; } return I18N.localise(this.unlocLocation); }
@Override public void markDirty() { super.markDirty(); ++this.guiRefreshCounter; }
public void setReadOnly() { this.readOnly = true; this.forbidInsertion(); }