Class BlockPosData
java.lang.Object
net.darkhax.bookshelf.common.api.menu.data.BlockPosData
- All Implemented Interfaces:
net.minecraft.world.inventory.ContainerData
Allows a block position to be kept in sync using the container system. The server should always construct this
directly while the client should use SimpleContainerData with size of 3.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockPosData(net.minecraft.core.BlockPos pos) BlockPosData(net.minecraft.core.BlockPos pos, boolean mutable) -
Method Summary
Modifier and TypeMethodDescriptionintget(int slot) intgetCount()net.minecraft.core.BlockPosgetPos()Gets the BlockPos currently held by the container data.static net.minecraft.core.BlockPosreadPos(net.minecraft.world.inventory.ContainerData data) Reads a BlockPos from untyped container data.voidset(int slot, int value)
-
Constructor Details
-
BlockPosData
public BlockPosData(net.minecraft.core.BlockPos pos) -
BlockPosData
public BlockPosData(net.minecraft.core.BlockPos pos, boolean mutable)
-
-
Method Details
-
get
public int get(int slot) - Specified by:
getin interfacenet.minecraft.world.inventory.ContainerData
-
set
public void set(int slot, int value) - Specified by:
setin interfacenet.minecraft.world.inventory.ContainerData
-
getCount
public int getCount()- Specified by:
getCountin interfacenet.minecraft.world.inventory.ContainerData
-
getPos
public net.minecraft.core.BlockPos getPos()Gets the BlockPos currently held by the container data. This should only be called on the server.- Returns:
- The BlockPos being held.
-
readPos
public static net.minecraft.core.BlockPos readPos(net.minecraft.world.inventory.ContainerData data) Reads a BlockPos from untyped container data. This should be used to read the position on the client which should be using a SimpleContainerData and not a BlockPosData.- Parameters:
data- The data to read from.- Returns:
- The BlockPos that was ready.
-