Class NBTCraftingGrid
java.lang.Object
net.minecraft.world.inventory.CraftingContainer
org.cyclops.evilcraft.core.inventory.NBTCraftingGrid
- All Implemented Interfaces:
net.minecraft.world.Clearable,net.minecraft.world.Container,net.minecraft.world.inventory.StackedContentsCompatible
public class NBTCraftingGrid
extends net.minecraft.world.inventory.CraftingContainer
A simple implementation of a crafting grid that stores it's inventory in NBT.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.world.InteractionHandprotected intprotected net.minecraft.world.entity.player.PlayerFields inherited from interface net.minecraft.world.Container
LARGE_MAX_STACK_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionNBTCraftingGrid(net.minecraft.world.entity.player.Player player, int itemIndex, net.minecraft.world.InteractionHand hand, net.minecraft.world.inventory.AbstractContainerMenu eventHandler) Make a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidreadFromNBT(net.minecraft.nbt.CompoundTag data, String tagName) voidsave()Save the grid state to NBT.protected voidwriteToNBT(net.minecraft.nbt.CompoundTag data, String tagName) Methods inherited from class net.minecraft.world.inventory.CraftingContainer
clearContent, fillStackedContents, getContainerSize, getHeight, getItem, getWidth, isEmpty, removeItem, removeItemNoUpdate, setChanged, setItem, stillValidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.Container
canPlaceItem, countItem, getMaxStackSize, hasAnyOf, startOpen, stopOpen
-
Field Details
-
player
protected net.minecraft.world.entity.player.Player player -
itemIndex
protected int itemIndex -
hand
protected net.minecraft.world.InteractionHand hand
-
-
Constructor Details
-
NBTCraftingGrid
public NBTCraftingGrid(net.minecraft.world.entity.player.Player player, int itemIndex, net.minecraft.world.InteractionHand hand, net.minecraft.world.inventory.AbstractContainerMenu eventHandler) Make a new instance.- Parameters:
player- The player using the grid.itemIndex- The index of the item in the player inventory.eventHandler- The event handler if the grid changes.hand- The hand the player is using.
-
-
Method Details
-
save
public void save()Save the grid state to NBT. -
readFromNBT
-
writeToNBT
-