use of pl.asie.charset.lib.utils.Orientation in project Charset by CharsetMC.
the class TileReflector method onPlacedBy.
@Override
public void onPlacedBy(EntityLivingBase placer, @Nullable EnumFacing face, ItemStack stack, float hitX, float hitY, float hitZ) {
color = LaserColor.VALUES[stack.getItemDamage() & 7];
Orientation orientation = SpaceUtils.getOrientation(getWorld(), getPos(), placer, face, hitX, hitY, hitZ);
EnumFacing rotation = null;
switch(orientation) {
case FACE_UP_POINT_NORTH:
case FACE_NORTH_POINT_UP:
case FACE_DOWN_POINT_SOUTH:
case FACE_SOUTH_POINT_DOWN:
rotation = EnumFacing.WEST;
break;
case FACE_DOWN_POINT_NORTH:
case FACE_NORTH_POINT_DOWN:
case FACE_UP_POINT_SOUTH:
case FACE_SOUTH_POINT_UP:
rotation = EnumFacing.EAST;
break;
case FACE_WEST_POINT_UP:
case FACE_UP_POINT_WEST:
case FACE_EAST_POINT_DOWN:
case FACE_DOWN_POINT_EAST:
rotation = EnumFacing.SOUTH;
break;
case FACE_WEST_POINT_DOWN:
case FACE_DOWN_POINT_WEST:
case FACE_EAST_POINT_UP:
case FACE_UP_POINT_EAST:
rotation = EnumFacing.NORTH;
break;
case FACE_WEST_POINT_NORTH:
case FACE_NORTH_POINT_WEST:
case FACE_EAST_POINT_SOUTH:
case FACE_SOUTH_POINT_EAST:
rotation = EnumFacing.UP;
break;
case FACE_EAST_POINT_NORTH:
case FACE_NORTH_POINT_EAST:
case FACE_WEST_POINT_SOUTH:
case FACE_SOUTH_POINT_WEST:
rotation = EnumFacing.DOWN;
break;
}
world.setBlockState(pos, world.getBlockState(pos).withProperty(BlockReflector.ROTATION, rotation));
}
Aggregations