Class BlockPosData

java.lang.Object
net.darkhax.bookshelf.common.api.menu.data.BlockPosData
All Implemented Interfaces:
net.minecraft.world.inventory.ContainerData

public class BlockPosData extends Object implements 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

    Constructors
    Constructor
    Description
    BlockPosData(net.minecraft.core.BlockPos pos)
     
    BlockPosData(net.minecraft.core.BlockPos pos, boolean mutable)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    get(int slot)
     
    int
     
    net.minecraft.core.BlockPos
    Gets the BlockPos currently held by the container data.
    static net.minecraft.core.BlockPos
    readPos(net.minecraft.world.inventory.ContainerData data)
    Reads a BlockPos from untyped container data.
    void
    set(int slot, int value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      get in interface net.minecraft.world.inventory.ContainerData
    • set

      public void set(int slot, int value)
      Specified by:
      set in interface net.minecraft.world.inventory.ContainerData
    • getCount

      public int getCount()
      Specified by:
      getCount in interface net.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.