java.lang.Object
com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState

public class WrappedBlockState extends Object
This class is designed to take advantage of modern minecraft versions It has also been designed so that legacy versions can use this system

Write your code once, and use it everywhere. Platform and version agnostic.

The mappings for legacy versions (1.12) was generated by setting blocks in the world at the pos id * 2, 255, data * 2 and then the world was upgraded to 1.18 and the block was read, dumping it all into a text file.

Mappings from modern versions are from ViaVersion, who have a similar (but a bit slower) system.

  • Constructor Details

  • Method Details

    • decode

      public static WrappedBlockState decode(NBT nbt, ClientVersion version)
    • encode

      public static NBT encode(WrappedBlockState state, ClientVersion version)
    • getByGlobalId

      @NotNull public static @NotNull WrappedBlockState getByGlobalId(int globalID)
    • getByGlobalId

      @NotNull public static @NotNull WrappedBlockState getByGlobalId(int globalID, boolean clone)
    • getByGlobalId

      @NotNull public static @NotNull WrappedBlockState getByGlobalId(ClientVersion version, int globalID)
    • getByGlobalId

      @NotNull public static @NotNull WrappedBlockState getByGlobalId(ClientVersion version, int globalID, boolean clone)
    • getByString

      @NotNull public static @NotNull WrappedBlockState getByString(String string)
    • getByString

      @NotNull public static @NotNull WrappedBlockState getByString(ClientVersion version, String string)
    • getByString

      @NotNull public static @NotNull WrappedBlockState getByString(ClientVersion version, String string, boolean clone)
    • getDefaultState

      @NotNull public static @NotNull WrappedBlockState getDefaultState(StateType type)
    • getDefaultState

      @NotNull public static @NotNull WrappedBlockState getDefaultState(ClientVersion version, StateType type)
    • getDefaultState

      @NotNull public static @NotNull WrappedBlockState getDefaultState(ClientVersion version, StateType type, boolean clone)
    • clone

      public WrappedBlockState clone()
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getType

      public StateType getType()
    • getAge

      public int getAge()
    • setAge

      public void setAge(int age)
    • isAttached

      public boolean isAttached()
    • setAttached

      public void setAttached(boolean attached)
    • getAttachment

      public Attachment getAttachment()
    • setAttachment

      public void setAttachment(Attachment attachment)
    • getAxis

      public Axis getAxis()
    • setAxis

      public void setAxis(Axis axis)
    • isBerries

      public boolean isBerries()
    • setBerries

      public void setBerries(boolean berries)
    • getBites

      public int getBites()
    • setBites

      public void setBites(int bites)
    • isBottom

      public boolean isBottom()
    • setBottom

      public void setBottom(boolean bottom)
    • getCandles

      public int getCandles()
    • setCandles

      public void setCandles(int candles)
    • getCharges

      public int getCharges()
    • setCharges

      public void setCharges(int charges)
    • isConditional

      public boolean isConditional()
    • setConditional

      public void setConditional(boolean conditional)
    • getDelay

      public int getDelay()
    • setDelay

      public void setDelay(int delay)
    • isDisarmed

      public boolean isDisarmed()
    • setDisarmed

      public void setDisarmed(boolean disarmed)
    • getDistance

      public int getDistance()
    • setDistance

      public void setDistance(int distance)
    • isDown

      public boolean isDown()
    • setDown

      public void setDown(boolean down)
    • isDrag

      public boolean isDrag()
    • setDrag

      public void setDrag(boolean drag)
    • isDusted

      public boolean isDusted()
    • setDusted

      public void setDusted(boolean dusted)
    • getEggs

      public int getEggs()
    • setEggs

      public void setEggs(int eggs)
    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public void setEnabled(boolean enabled)
    • isExtended

      public boolean isExtended()
    • setExtended

      public void setExtended(boolean extended)
    • isEye

      public boolean isEye()
    • setEye

      public void setEye(boolean eye)
    • getFace

      public Face getFace()
    • setFace

      public void setFace(Face face)
    • getFacing

      public BlockFace getFacing()
    • setFacing

      public void setFacing(BlockFace facing)
    • getFlowerAmount

      public int getFlowerAmount()
    • setFlowerAmount

      public void setFlowerAmount(int flowerAmount)
    • getHalf

      public Half getHalf()
    • setHalf

      public void setHalf(Half half)
    • isHanging

      public boolean isHanging()
    • setHanging

      public void setHanging(boolean hanging)
    • isHasBook

      public boolean isHasBook()
    • setHasBook

      public void setHasBook(boolean hasBook)
    • isHasBottle0

      public boolean isHasBottle0()
    • setHasBottle0

      public void setHasBottle0(boolean hasBottle0)
    • isHasBottle1

      public boolean isHasBottle1()
    • setHasBottle1

      public void setHasBottle1(boolean hasBottle1)
    • isHasBottle2

      public boolean isHasBottle2()
    • setHasBottle2

      public void setHasBottle2(boolean hasBottle2)
    • isHasRecord

      public boolean isHasRecord()
    • setHasRecord

      public void setHasRecord(boolean hasRecord)
    • getHatch

      public int getHatch()
    • setHatch

      public void setHatch(int hatch)
    • getHinge

      public Hinge getHinge()
    • setHinge

      public void setHinge(Hinge hinge)
    • getHoneyLevel

      public int getHoneyLevel()
    • setHoneyLevel

      public void setHoneyLevel(int honeyLevel)
    • isInWall

      public boolean isInWall()
    • setInWall

      public void setInWall(boolean inWall)
    • getInstrument

      public Instrument getInstrument()
    • setInstrument

      public void setInstrument(Instrument instrument)
    • isInverted

      public boolean isInverted()
    • setInverted

      public void setInverted(boolean inverted)
    • getLayers

      public int getLayers()
    • setLayers

      public void setLayers(int layers)
    • getLeaves

      public Leaves getLeaves()
    • setLeaves

      public void setLeaves(Leaves leaves)
    • getLevel

      public int getLevel()
    • setLevel

      public void setLevel(int level)
    • isLit

      public boolean isLit()
    • setLit

      public void setLit(boolean lit)
    • isTip

      public boolean isTip()
    • setTip

      public void setTip(boolean tip)
    • isLocked

      public boolean isLocked()
    • setLocked

      public void setLocked(boolean locked)
    • getMode

      public Mode getMode()
    • setMode

      public void setMode(Mode mode)
    • getMoisture

      public int getMoisture()
    • setMoisture

      public void setMoisture(int moisture)
    • getNorth

      public North getNorth()
    • setNorth

      public void setNorth(North north)
    • getNote

      public int getNote()
    • setNote

      public void setNote(int note)
    • isOccupied

      public boolean isOccupied()
    • setOccupied

      public void setOccupied(boolean occupied)
    • isShrieking

      public boolean isShrieking()
    • setShrieking

      public void setShrieking(boolean shrieking)
    • isCanSummon

      public boolean isCanSummon()
    • setCanSummon

      public void setCanSummon(boolean canSummon)
    • isOpen

      public boolean isOpen()
    • setOpen

      public void setOpen(boolean open)
    • getOrientation

      public Orientation getOrientation()
    • setOrientation

      public void setOrientation(Orientation orientation)
    • getPart

      public Part getPart()
    • setPart

      public void setPart(Part part)
    • isPersistent

      public boolean isPersistent()
    • setPersistent

      public void setPersistent(boolean persistent)
    • getPickles

      public int getPickles()
    • setPickles

      public void setPickles(int pickles)
    • getPower

      public int getPower()
    • setPower

      public void setPower(int power)
    • isPowered

      public boolean isPowered()
    • setPowered

      public void setPowered(boolean powered)
    • getRotation

      public int getRotation()
    • setRotation

      public void setRotation(int rotation)
    • getSculkSensorPhase

      public SculkSensorPhase getSculkSensorPhase()
    • setSculkSensorPhase

      public void setSculkSensorPhase(SculkSensorPhase sculkSensorPhase)
    • getShape

      public Shape getShape()
    • setShape

      public void setShape(Shape shape)
    • isShort

      public boolean isShort()
    • setShort

      public void setShort(boolean short_)
    • isSignalFire

      public boolean isSignalFire()
    • setSignalFire

      public void setSignalFire(boolean signalFire)
    • isSlotZeroOccupied

      public boolean isSlotZeroOccupied()
    • setSlotZeroOccupied

      public void setSlotZeroOccupied(boolean slotZeroOccupied)
    • isSlotOneOccupied

      public boolean isSlotOneOccupied()
    • setSlotOneOccupied

      public void setSlotOneOccupied(boolean slotOneOccupied)
    • isSlotTwoOccupied

      public boolean isSlotTwoOccupied()
    • setSlotTwoOccupied

      public void setSlotTwoOccupied(boolean slotTwoOccupied)
    • isSlotThreeOccupied

      public boolean isSlotThreeOccupied()
    • setSlotThreeOccupied

      public void setSlotThreeOccupied(boolean slotThreeOccupied)
    • isSlotFourOccupied

      public boolean isSlotFourOccupied()
    • setSlotFourOccupied

      public void setSlotFourOccupied(boolean slotFourOccupied)
    • isSlotFiveOccupied

      public boolean isSlotFiveOccupied()
    • setSlotFiveOccupied

      public void setSlotFiveOccupied(boolean slotFiveOccupied)
    • isSnowy

      public boolean isSnowy()
    • setSnowy

      public void setSnowy(boolean snowy)
    • getStage

      public int getStage()
    • setStage

      public void setStage(int stage)
    • getSouth

      public South getSouth()
    • setSouth

      public void setSouth(South south)
    • getThickness

      public Thickness getThickness()
    • setThickness

      public void setThickness(Thickness thickness)
    • getTilt

      public Tilt getTilt()
    • setTilt

      public void setTilt(Tilt tilt)
    • isTriggered

      public boolean isTriggered()
    • setTriggered

      public void setTriggered(boolean triggered)
    • getTypeData

      public Type getTypeData()
    • setTypeData

      public void setTypeData(Type type)
    • isUnstable

      public boolean isUnstable()
    • setUnstable

      public void setUnstable(boolean unstable)
    • isUp

      public boolean isUp()
    • setUp

      public void setUp(boolean up)
    • getVerticalDirection

      public VerticalDirection getVerticalDirection()
    • setVerticalDirection

      public void setVerticalDirection(VerticalDirection verticalDirection)
    • isWaterlogged

      public boolean isWaterlogged()
    • setWaterlogged

      public void setWaterlogged(boolean waterlogged)
    • getEast

      public East getEast()
    • setEast

      public void setEast(East west)
    • getWest

      public West getWest()
    • setWest

      public void setWest(West west)
    • getBloom

      public Bloom getBloom()
    • setBloom

      public void setBloom(Bloom bloom)
    • isCracked

      public boolean isCracked()
    • setCracked

      public void setCracked(boolean cracked)
    • isCrafting

      public boolean isCrafting()
    • setCrafting

      public void setCrafting(boolean crafting)
    • getTrialSpawnerState

      public TrialSpawnerState getTrialSpawnerState()
    • setTrialSpawnerState

      public void setTrialSpawnerState(TrialSpawnerState trialSpawnerState)
    • getCreaking

      @Obsolete public CreakingHeartState getCreaking()
      Removed with 1.21.4
    • setCreaking

      @Obsolete public void setCreaking(CreakingHeartState creakingHeartState)
      Removed with 1.21.4
    • isActive

      public boolean isActive()
      Added with 1.21.4
    • setActive

      public void setActive(boolean active)
      Added with 1.21.4
    • isNatural

      public boolean isNatural()
      Added with 1.21.4
    • setNatural

      public void setNatural(boolean natural)
      Added with 1.21.4
    • getInternalData

      @Deprecated public Map<StateValue,Object> getInternalData()
      Deprecated.
      This method is helpful if you want to check if a block can be waterlogged, or has other properties.

      Unless you know what you are doing exactly, don't touch this method! It can result in invalid block types when modified directly

    • getGlobalId

      public int getGlobalId()
      Global ID For pre-1.13: 4 bits of block data, 4 bits empty, 8 bits block type For post-1.13: Global ID
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • ensureLoad

      public static void ensureLoad()