Skip to content

Commit

Permalink
cleanup blockutils
Browse files Browse the repository at this point in the history
  • Loading branch information
Wide-Cat committed Sep 6, 2023
1 parent 30bbdca commit 74deeea
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,24 +270,12 @@ public static Direction getDirection(BlockPos pos) {
Vec3d eyesPos = new Vec3d(mc.player.getX(), mc.player.getY() + mc.player.getEyeHeight(mc.player.getPose()), mc.player.getZ());
if ((double) pos.getY() > eyesPos.y) {
if (mc.world.getBlockState(pos.add(0, -1, 0)).isReplaceable()) return Direction.DOWN;
else return getOppositeDirection();
else return mc.player.getHorizontalFacing().getOpposite();
}
if (!mc.world.getBlockState(pos.add(0, 1, 0)).isReplaceable()) return getOppositeDirection();
if (!mc.world.getBlockState(pos.add(0, 1, 0)).isReplaceable()) return mc.player.getHorizontalFacing().getOpposite();
return Direction.UP;
}

// Example: If the player is facing east, then that means they would click the west side of a block.
private static Direction getOppositeDirection() {
return switch (mc.player.getHorizontalFacing()) {
case DOWN -> Direction.UP;
case UP -> Direction.DOWN;
case NORTH -> Direction.SOUTH;
case SOUTH -> Direction.NORTH;
case WEST -> Direction.EAST;
case EAST -> Direction.WEST;
};
}

public enum MobSpawn {
Never,
Potential,
Expand Down

0 comments on commit 74deeea

Please sign in to comment.