Package codechicken.lib.util
Class RotationUtils
java.lang.Object
codechicken.lib.util.RotationUtils
Contains a bunch of stuff to do with rotation.
Created by covers1624 on 6/30/2016.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic net.minecraft.core.DirectionentityRotationToSide(int rotation) Turns Entity rotation in to Direction.static net.minecraft.core.DirectiongetPlacedRotation(net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LivingEntity entity) Gets rotation for placing a block, Will use Up and Down.static net.minecraft.core.DirectiongetPlacedRotation(net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LivingEntity entity, boolean onlyHorizon) Short hand for getPlacedRotationHorizontal and getPlacedRotation.static net.minecraft.core.DirectiongetPlacedRotationHorizontal(net.minecraft.world.entity.LivingEntity entity) Gets the rotation for placing a block only on the horizon.static net.minecraft.core.DirectionrotateBackwards(net.minecraft.core.Direction facing) Rotate this Facing around all axises counter-clockwise (NORTH => DOWN => UP => WEST => EAST => SOUTH => NORTH)static net.minecraft.core.DirectionrotateClockwise(net.minecraft.core.Direction facing) Rotate this Facing around the Y axis counter-clockwise (NORTH => EAST => SOUTH => WEST => NORTH)static net.minecraft.core.DirectionrotateCounterClockwise(net.minecraft.core.Direction facing) Rotate this Facing around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH)static net.minecraft.core.DirectionrotateForward(net.minecraft.core.Direction facing) Rotate this Facing around all axises counter-clockwise (NORTH => SOUTH => EAST => WEST => UP => DOWN => NORTH)
-
Constructor Details
-
RotationUtils
public RotationUtils()
-
-
Method Details
-
getPlacedRotationHorizontal
public static net.minecraft.core.Direction getPlacedRotationHorizontal(net.minecraft.world.entity.LivingEntity entity) Gets the rotation for placing a block only on the horizon.- Parameters:
entity- Entity placing block.- Returns:
- Direction placed.
-
getPlacedRotation
public static net.minecraft.core.Direction getPlacedRotation(net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LivingEntity entity) Gets rotation for placing a block, Will use Up and Down.- Parameters:
pos- Pos placement is happening.entity- Entity placing block.- Returns:
- Direction placed.
-
getPlacedRotation
public static net.minecraft.core.Direction getPlacedRotation(net.minecraft.core.BlockPos pos, net.minecraft.world.entity.LivingEntity entity, boolean onlyHorizon) Short hand for getPlacedRotationHorizontal and getPlacedRotation.- Parameters:
pos- Pos placement is happening.entity- Entity placing block.onlyHorizon- True if should only obey the horizon.- Returns:
- Direction placed.
-
rotateCounterClockwise
public static net.minecraft.core.Direction rotateCounterClockwise(net.minecraft.core.Direction facing) Rotate this Facing around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH)- Parameters:
facing- Current facing.- Returns:
- Next facing.
-
rotateClockwise
public static net.minecraft.core.Direction rotateClockwise(net.minecraft.core.Direction facing) Rotate this Facing around the Y axis counter-clockwise (NORTH => EAST => SOUTH => WEST => NORTH)- Parameters:
facing- Current facing.- Returns:
- Next facing.
-
rotateForward
public static net.minecraft.core.Direction rotateForward(net.minecraft.core.Direction facing) Rotate this Facing around all axises counter-clockwise (NORTH => SOUTH => EAST => WEST => UP => DOWN => NORTH)- Parameters:
facing- Current facing.- Returns:
- Next facing.
-
rotateBackwards
public static net.minecraft.core.Direction rotateBackwards(net.minecraft.core.Direction facing) Rotate this Facing around all axises counter-clockwise (NORTH => DOWN => UP => WEST => EAST => SOUTH => NORTH)- Parameters:
facing- Current facing.- Returns:
- Next facing.
-
entityRotationToSide
public static net.minecraft.core.Direction entityRotationToSide(int rotation) Turns Entity rotation in to Direction.- Parameters:
rotation- The entity rotation, GenerallyMathHelper.floor_double((entity.rotationYaw * 4F) / 360F + 0.5D) & 3;- Returns:
- The rotation in Direction.
-