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(org.bukkit.block.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(org.bukkit.entity.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

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

      public DexBlock(DexBlockState state, org.bukkit.util.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)
    • getEntity

      public org.bukkit.entity.BlockDisplay getEntity()
    • getTempVector

      public org.bukkit.util.Vector getTempVector()
      Get the temporary vector, used in processing
    • setTempVector

      public void setTempVector(org.bukkit.util.Vector v)
      Set the temporary vector, used in processing
    • 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(org.bukkit.Location loc)
    • move

      public void move(org.bukkit.util.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 org.bukkit.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