Class DexBlock

java.lang.Object
me.c7dev.dexterity.util.DexBlock

public class DexBlock extends Object
Provides a wrapper for a BlockDisplay entity that holds data about its DexTransformation, roll offset, and more
  • Field Details

  • Constructor Details

    • DexBlock

      public DexBlock(Block block, DexterityDisplay d)
      Convert a block into block display
      Parameters:
      block - The block to convert
      d - The selection to register the new block display under
    • DexBlock

      public DexBlock(BlockDisplay bd, DexterityDisplay d)
      Create a wrapper for a block display that is part of a selection
      Parameters:
      bd - The block display to register
      d - The selection to register the new block display under
    • DexBlock

      @Deprecated public DexBlock(BlockDisplay bd, DexterityDisplay d, float roll)
      Deprecated.
      Create a wrapper for a block display that is part of a selection. Must manually subtract the RollOffset afterwards
      Parameters:
      bd - The block display to register
      d - The selection to register the new block display under
      roll - The roll, in degrees, that will forced into the wrapper
    • DexBlock

      public DexBlock(DexBlockState state)
      Spawn a block display wrapper based on a previously recorded state
      Parameters:
      state -
    • DexBlock

      public DexBlock(DexBlockState state, Vector offset)
      Spawn a block display wrapper based on a previously recorded state
      Parameters:
      state -
      offset - Translation to put block at a different location
  • Method Details

    • getUniqueId

      public UUID getUniqueId()
    • loadRoll

      public void loadRoll(HashMap<OrientationKey,RollOffset> cache)
      Calculate the roll, recommended to do async (done automatically when plugin is enabled)
      Parameters:
      cache - Modifyable cache for similar rotation orientations
    • loadRoll

      public void loadRoll()
      Calculate the roll, recommended to do async (done automatically when plugin is enabled)
    • loadTransformationAndRoll

      public void loadTransformationAndRoll()
      Sets up the Block Display's transformation to follow Dexterity convention, centers the block display, and loads roll data
    • getEntity

      public BlockDisplay getEntity()
    • getTempVector

      public Vector getTempVector()
      Get the temporary vector, used in processing
    • setTempVector

      public void setTempVector(Vector v)
      Set the temporary vector, used in processing
    • setDexterityDisplay

      @Deprecated public void setDexterityDisplay(DexterityDisplay d)
      Deprecated.
    • getRoll

      public float getRoll()
      Gets the roll in degrees. Yaw and pitch can be retrieved from the entity's location
      Returns:
      The roll in degrees
    • setRoll

      public void setRoll(float f)
      Set a new transformation for the given roll
      Parameters:
      f - The roll in degrees
    • getDexterityDisplay

      public DexterityDisplay getDexterityDisplay()
    • getTransformation

      public DexTransformation getTransformation()
    • getState

      public DexBlockState getState()
    • loadState

      public void loadState(DexBlockState state)
      Loads in another state without spawning a new entity
      Parameters:
      state -
    • setTransformation

      public void setTransformation(DexTransformation dt)
      Sets the transformation wrapper and updates the entity
      Parameters:
      dt -
    • updateTransformation

      public void updateTransformation()
      Updates the entity's transformation to the current values of its mutable DexTransformation
    • teleport

      public void teleport(Location loc)
    • move

      public void move(Vector v)
      Move the block display entity by an offset
      Parameters:
      v -
    • move

      public void move(double x, double y, double z)
      Move the block display entity by an offset
      Parameters:
      x - Distance in blocks
      y - Distance in blocks
      z - Distance in blocks
    • remove

      public void remove()
      Kill entity and unregister from selection
    • hashCode

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

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

      public Location getLocation()
      Roll-offset adjusted location of the center of the block display entity. This is not necessarily the entity's location if other plugins are being used.
      Returns:
      Unmodifiable location of the center of the block display