Package me.c7dev.dexterity.util
Class DexBlock
java.lang.Object
me.c7dev.dexterity.util.DexBlock
Provides a wrapper for a
BlockDisplay
entity that holds data about its DexTransformation
, roll offset, and more-
Field Summary
-
Constructor Summary
ConstructorDescriptionDexBlock
(DexBlockState state) Spawn a block display wrapper based on a previously recorded stateDexBlock
(DexBlockState state, org.bukkit.util.Vector offset) Spawn a block display wrapper based on a previously recorded stateDexBlock
(org.bukkit.block.Block block, DexterityDisplay d) Convert a block into block displayDexBlock
(org.bukkit.entity.BlockDisplay bd, DexterityDisplay d) Create a wrapper for a block display that is part of a selection -
Method Summary
Modifier and TypeMethodDescriptionboolean
org.bukkit.entity.BlockDisplay
org.bukkit.Location
Roll-offset adjusted location of the center of the block display entity.float
getRoll()
Gets the roll in degrees.getState()
org.bukkit.util.Vector
Get the temporary vector, used in processingint
hashCode()
void
loadRoll()
Calculate the roll, recommended to do async (done automatically when plugin is enabled)void
loadRoll
(HashMap<OrientationKey, RollOffset> cache) Calculate the roll, recommended to do async (done automatically when plugin is enabled)void
loadState
(DexBlockState state) Loads in another state without spawning a new entityvoid
move
(double x, double y, double z) Move the block display entity by an offsetvoid
move
(org.bukkit.util.Vector v) Move the block display entity by an offsetvoid
remove()
Kill entity and unregister from selectionvoid
setRoll
(float f) Set a new transformation for the given rollvoid
setTempVector
(org.bukkit.util.Vector v) Set the temporary vector, used in processingvoid
Sets the transformation wrapper and updates the entityvoid
teleport
(org.bukkit.Location loc) void
Updates the entity's transformation to the current values of its mutableDexTransformation
-
Field Details
-
TELEPORT_DURATION
public static final int TELEPORT_DURATION- See Also:
-
-
Constructor Details
-
DexBlock
Convert a block into block display- Parameters:
block
- The block to convertd
- The selection to register the new block display under
-
DexBlock
Create a wrapper for a block display that is part of a selection- Parameters:
bd
- The block display to registerd
- The selection to register the new block display under
-
DexBlock
Spawn a block display wrapper based on a previously recorded state- Parameters:
state
-
-
DexBlock
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
-
loadRoll
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
-
getTransformation
-
getState
-
loadState
Loads in another state without spawning a new entity- Parameters:
state
-
-
setTransformation
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 mutableDexTransformation
-
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 blocksy
- Distance in blocksz
- Distance in blocks
-
remove
public void remove()Kill entity and unregister from selection -
hashCode
public int hashCode() -
equals
-
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
-