| Modifier and Type | Class and Description |
|---|---|
static class |
Orientation.OrientationChangeEvent |
Stateful.LoadEvent, Stateful.UnloadEvent| Modifier and Type | Field and Description |
|---|---|
boolean |
isFlip |
protected Direction |
orientation
The direction the block is facing.
|
ComponentProvider<? extends ComponentMap> |
provider |
java.util.function.Predicate<Direction> |
rotationFilter
The allowed rotation directions the block can face.
|
| Constructor and Description |
|---|
Orientation(ComponentProvider provider) |
| Modifier and Type | Method and Description |
|---|---|
Direction |
calculateDirection(Entity entity)
Calculates the direction using raytracing
|
Direction |
calculateDirectionFromEntity(Entity entity)
Determines the direction the block is facing based on the entity's facing
|
boolean |
canRotate(Direction side) |
boolean |
canRotate(int side) |
Orientation |
flipPlacement(boolean flip)
Set to true to use the oposite direction
|
int |
getSideToRotate(int hitSide,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D hit)
Determines the side to rotate based on the hit vector on the block.
|
Orientation |
hookBasedOnEntity()
Hooks the needed events intro the block to rotate based on the
Entity's rotation when placing the block |
Orientation |
hookBasedOnHitSide()
Hooks the needed events intro the block to rotate based on the side that is hit when placing the block
|
Orientation |
hookRightClickRotate()
Hooks the needed events intro the block to rotate when the block is right clicked.
|
void |
load(Data data)
Loads all the data for this object.
|
Direction |
orientation() |
void |
read(Packet packet)
Reads a packet.
|
boolean |
rotate(int side,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D hit)
Rotatable Block
|
void |
save(Data data)
Saves all the data of this object.
|
Orientation |
setMask(Direction... rotationFilter)
Set's the rotation mask
|
Orientation |
setMask(int rotationFilter)
Set's the rotation mask
|
Orientation |
setMask(java.util.function.Predicate<Direction> rotationFilter)
Set's the rotation mask
|
Orientation |
setOrientation(Direction orientation)
Changes the orientation
|
void |
write(Packet packet)
Writes a packet based on the arguments.
|
getID, getProvider, onProviderChangeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsameTypepublic final ComponentProvider<? extends ComponentMap> provider
public java.util.function.Predicate<Direction> rotationFilter
public boolean isFlip
protected Direction orientation
public Orientation(ComponentProvider provider)
provider - The block to apply discrete orientations topublic Orientation hookBasedOnHitSide()
public Orientation hookBasedOnEntity()
Entity's rotation when placing the blockpublic Orientation hookRightClickRotate()
public Direction orientation()
public Orientation setOrientation(Direction orientation)
orientation - New orientationpublic Orientation setMask(java.util.function.Predicate<Direction> rotationFilter)
rotationFilter - New rotation masksetMask(Direction...),
setMask(int)public Orientation setMask(Direction... rotationFilter)
rotationFilter - New rotation masksetMask(Predicate),
setMask(int)public Orientation setMask(int rotationFilter)
rotationFilter - New rotation mask
Each bit corresponds to a direction.
E.g: 000011 will allow only up and downsetMask(Predicate),
setMask(Direction...)public Orientation flipPlacement(boolean flip)
flip - should flip rotation or notpublic Direction calculateDirection(Entity entity)
entity - The entity to start raytracing frompublic Direction calculateDirectionFromEntity(Entity entity)
entity - The entity used to determine rotationpublic boolean canRotate(int side)
public boolean canRotate(Direction side)
public boolean rotate(int side,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D hit)
side - The hit sidehit - The hit vectorpublic int getSideToRotate(int hitSide,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D hit)
hitSide - The hit sidehit - The hit vector