Last active
July 3, 2016 14:12
-
-
Save gigaherz/758d42975fd5824e01959ba746d95799 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gigaherz.enderRift.common.container; | |
import net.minecraft.item.ItemStack; | |
public interface IItemHandlerContainer | |
{ | |
boolean isItemValidForSlot(int slot, ItemStack stack); | |
int getInventoryStackLimit(int slot); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gigaherz.enderRift.common.container; | |
import net.minecraft.item.ItemStack; | |
import net.minecraftforge.items.ItemStackHandler; | |
public class ItemStackHandlerContainer extends ItemStackHandler implements IItemHandlerContainer | |
{ | |
public ItemStackHandlerContainer() | |
{ | |
super(); | |
} | |
public ItemStackHandlerContainer(int slots) | |
{ | |
super(slots); | |
} | |
@Override | |
public boolean isItemValidForSlot(int slot, ItemStack stack) | |
{ | |
return true; | |
} | |
@Override | |
public int getInventoryStackLimit(int slot) | |
{ | |
return 64; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package gigaherz.enderRift.common.container; | |
import net.minecraft.item.ItemStack; | |
import net.minecraftforge.items.IItemHandler; | |
import net.minecraftforge.items.SlotItemHandler; | |
public class SlotItemHandlerContainer extends SlotItemHandler | |
{ | |
public SlotItemHandlerContainer(IItemHandler itemHandler, int index, int xPosition, int yPosition) | |
{ | |
super(itemHandler, index, xPosition, yPosition); | |
} | |
@Override | |
public boolean isItemValid(ItemStack stack) | |
{ | |
IItemHandler itemHandler = getItemHandler(); | |
if (itemHandler instanceof IItemHandlerContainer) | |
return ((IItemHandlerContainer) itemHandler).isItemValidForSlot(slotNumber, stack); | |
return super.isItemValid(stack); | |
} | |
@Override | |
public int getSlotStackLimit() | |
{ | |
IItemHandler itemHandler = getItemHandler(); | |
if (itemHandler instanceof IItemHandlerContainer) | |
return ((IItemHandlerContainer) itemHandler).getInventoryStackLimit(slotNumber); | |
return 64; | |
} | |
@Override | |
public int getItemStackLimit(ItemStack stack) | |
{ | |
return getSlotStackLimit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment