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
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDexBlock(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 selectionDexBlock(org.bukkit.entity.BlockDisplay bd, DexterityDisplay d, float roll) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionbooleanorg.bukkit.entity.BlockDisplayorg.bukkit.LocationRoll-offset adjusted location of the center of the block display entity.floatgetRoll()Gets the roll in degrees.getState()org.bukkit.util.VectorGet the temporary vector, used in processinginthashCode()voidloadRoll()Calculate the roll, recommended to do async (done automatically when plugin is enabled)voidloadRoll(HashMap<OrientationKey, RollOffset> cache) Calculate the roll, recommended to do async (done automatically when plugin is enabled)voidloadState(DexBlockState state) Loads in another state without spawning a new entityvoidSets up the Block Display's transformation to follow Dexterity convention, centers the block display, and loads roll datavoidmove(double x, double y, double z) Move the block display entity by an offsetvoidmove(org.bukkit.util.Vector v) Move the block display entity by an offsetvoidremove()Kill entity and unregister from selectionvoidDeprecated.voidsetRoll(float f) Set a new transformation for the given rollvoidsetTempVector(org.bukkit.util.Vector v) Set the temporary vector, used in processingvoidSets the transformation wrapper and updates the entityvoidteleport(org.bukkit.Location loc) voidUpdates 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
Deprecated.Create a wrapper for a block display that is part of a selection. Must manually subtract theRollOffsetafterwards- Parameters:
bd- The block display to registerd- The selection to register the new block display underroll- The roll, in degrees, that will forced into the wrapper
-
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) -
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 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 -
setDexterityDisplay
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
-
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
-