net.minecraft.util.Rotation Java Examples

The following examples show how to use net.minecraft.util.Rotation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TileEntityInserter.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void rotate(Rotation rotationIn)
{
    List<EnumFacing> newList = new ArrayList<EnumFacing>();

    for (EnumFacing side : this.enabledSides)
    {
        newList.add(rotationIn.rotate(side));
    }

    this.enabledSides.clear();
    this.enabledSides.addAll(newList);
    this.updateValidSides(false);

    super.rotate(rotationIn);
}
 
Example #2
Source File: BlockBambooBlock.java    From Sakura_mod with MIT License 6 votes vote down vote up
/**
 * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
 * blockstate.
 */
public IBlockState withRotation(IBlockState state, Rotation rot)
{
    switch (rot){
        case COUNTERCLOCKWISE_90:
        case CLOCKWISE_90:

            switch (state.getValue(LOG_AXIS)){
                case X:
                    return state.withProperty(LOG_AXIS, EnumAxis.Z);
                case Z:
                    return state.withProperty(LOG_AXIS, EnumAxis.X);
                default:
                    return state;
            }

        default:
            return state;
    }
}
 
Example #3
Source File: WorldGenAbandonedBase.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
    if (ConfigHolder.abandonedBaseRarity == 0 ||
        world.getWorldType() == WorldType.FLAT ||
        world.provider.getDimensionType() != DimensionType.OVERWORLD ||
        !world.getWorldInfo().isMapFeaturesEnabled()) {
        return; //do not generate in flat worlds, or in non-surface worlds
    }
    BlockPos randomPos = new BlockPos(chunkX * 16 + 8, 0, chunkZ * 16 + 8);

    if (random.nextInt(ConfigHolder.abandonedBaseRarity) == 0) {
        int variantNumber = random.nextInt(3);
        Rotation rotation = Rotation.values()[random.nextInt(Rotation.values().length)];
        ResourceLocation templateId = new ResourceLocation(GTValues.MODID, "abandoned_base/abandoned_base_1_" + variantNumber);
        Template template = TemplateManager.getBuiltinTemplate(world, templateId);
        BlockPos originPos = template.getZeroPositionWithTransform(randomPos, Mirror.NONE, rotation);
        originPos = TemplateManager.calculateAverageGroundLevel(world, originPos, template.getSize());
        template.addBlocksToWorld(world, originPos, new PlacementSettings().setRotation(rotation));
    }
}
 
Example #4
Source File: SchematicPlacementManager.java    From litematica with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void setSubRegionRotation(SchematicPlacement placement, String regionName, Rotation rotation, IMessageConsumer feedback)
{
    if (placement.isLocked())
    {
        feedback.addMessage(MessageType.ERROR, "litematica.message.placement.cant_modify_is_locked");
        return;
    }

    SubRegionPlacement subPlacement = placement.getRelativeSubRegionPlacement(regionName);

    if (subPlacement != null)
    {
        this.onPrePlacementChange(placement);
        placement.setSubRegionRotation(regionName, rotation);
        this.onPlacementRegionModified(placement);
    }
}
 
Example #5
Source File: PositionUtils.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Returns the rotation that would transform <b>facingOriginal</b> into <b>facingRotated</b>.
 * @param facingOriginal
 * @param facingRotated
 * @return
 */
public static Rotation getRotation(EnumFacing facingOriginal, EnumFacing facingRotated)
{
    if (facingOriginal.getAxis() == EnumFacing.Axis.Y ||
        facingRotated.getAxis() == EnumFacing.Axis.Y || facingOriginal == facingRotated)
    {
        return Rotation.NONE;
    }

    if (facingRotated == facingOriginal.getOpposite())
    {
        return Rotation.CLOCKWISE_180;
    }

    return facingRotated == facingOriginal.rotateY() ? Rotation.CLOCKWISE_90 : Rotation.COUNTERCLOCKWISE_90;
}
 
Example #6
Source File: MapGenTofuCastle.java    From TofuCraftReload with MIT License 6 votes vote down vote up
private void create(World p_191092_1_, ChunkProviderTofu p_191092_2_, Random p_191092_3_, int p_191092_4_, int p_191092_5_) {
    Rotation rotation = Rotation.NONE;
    ChunkPrimer chunkprimer = new ChunkPrimer();
    p_191092_2_.setBlocksInChunk(p_191092_4_, p_191092_5_, chunkprimer);
    int i = 5;
    int j = 5;


    int k = chunkprimer.findGroundBlockIdx(7, 7);
    int l = chunkprimer.findGroundBlockIdx(7, 7 + j);
    int i1 = chunkprimer.findGroundBlockIdx(7 + i, 7);
    int j1 = chunkprimer.findGroundBlockIdx(7 + i, 7 + j);
    int k1 = Math.min(Math.min(k, l), Math.min(i1, j1));


    BlockPos blockpos = new BlockPos(p_191092_4_ * 16 + 8, k1, p_191092_5_ * 16 + 8);
    List<TofuCastlePiece.TofuCastleTemplate> list = Lists.<TofuCastlePiece.TofuCastleTemplate>newLinkedList();
    TofuCastlePiece.generateCore(p_191092_1_.getSaveHandler().getStructureTemplateManager(), blockpos, rotation, list, p_191092_3_);
    this.components.addAll(list);
    this.updateBoundingBox();
    this.isValid = true;

}
 
Example #7
Source File: TileEntityBarrel.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void rotate(Rotation rotationIn)
{
    List<EnumFacing> newList = new ArrayList<EnumFacing>();

    for (EnumFacing side : this.labels)
    {
        newList.add(rotationIn.rotate(side));
    }

    this.labels.clear();
    this.labels.addAll(newList);
    this.labelMask = this.getLabelMask(false);

    super.rotate(rotationIn);
}
 
Example #8
Source File: TofuCastlePiece.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private static void generatesub(TemplateManager templateManager, BlockPos pos, Rotation rotation, List<TofuCastleTemplate> list, Random random) {
    //generate entrance
    BlockPos pos1 = new BlockPos(pos.south(23).east(4));
    BlockPos pos2 = new BlockPos(pos.south(-15).east(4));
    list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos1, rotation, "tofucastle_entrance"));
    list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos2, rotation, "tofucastle_entrance"));
}
 
Example #9
Source File: PositionUtils.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Rotation getReverseRotation(Rotation rotation)
{
    switch (rotation)
    {
        case CLOCKWISE_90:          return Rotation.COUNTERCLOCKWISE_90;
        case COUNTERCLOCKWISE_90:   return Rotation.CLOCKWISE_90;
        case CLOCKWISE_180:         return Rotation.CLOCKWISE_180;
        default:                    return Rotation.NONE;
    }
}
 
Example #10
Source File: ItemBuildersWand.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void moveAreaImmediate(ItemStack stack, World world, EntityPlayer player, BlockPos posSrc1, BlockPos posSrc2, BlockPos posDst1,
        Mirror mirror, Rotation rotation)
{
    PlacementSettings placement = new PlacementSettings();
    placement.setMirror(mirror);
    placement.setRotation(rotation);
    placement.setIgnoreEntities(false);
    placement.setReplacedBlock(Blocks.BARRIER); // meh

    ReplaceMode replace = WandOption.REPLACE_EXISTING.isEnabled(stack, Mode.MOVE_DST) ? ReplaceMode.EVERYTHING : ReplaceMode.NOTHING;
    TemplateEnderUtilities template = new TemplateEnderUtilities(placement, replace);
    template.takeBlocksFromWorld(world, posSrc1, posSrc2.subtract(posSrc1), true, false);
    this.deleteArea(stack, world, player, posSrc1, posSrc2, true);
    template.addBlocksToWorld(world, posDst1);
}
 
Example #11
Source File: PositionUtils.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Vec3d transformedVec3d(Vec3d vec, Mirror mirrorIn, Rotation rotationIn)
{
    double x = vec.x;
    double y = vec.y;
    double z = vec.z;
    boolean isMirrored = true;

    switch (mirrorIn)
    {
        case LEFT_RIGHT:
            z = 1.0D - z;
            break;
        case FRONT_BACK:
            x = 1.0D - x;
            break;
        default:
            isMirrored = false;
    }

    switch (rotationIn)
    {
        case COUNTERCLOCKWISE_90:
            return new Vec3d(z, y, 1.0D - x);
        case CLOCKWISE_90:
            return new Vec3d(1.0D - z, y, x);
        case CLOCKWISE_180:
            return new Vec3d(1.0D - x, y, 1.0D - z);
        default:
            return isMirrored ? new Vec3d(x, y, z) : vec;
    }
}
 
Example #12
Source File: TofuCastlePiece.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private static void generateUnderSub(TemplateManager templateManager, BlockPos pos, Rotation rotation, List<TofuCastleTemplate> list, Random random) {
    //east
    BlockPos pos1 = new BlockPos(pos.south(4).east(15));
    //west
    BlockPos pos2 = new BlockPos(pos.south(4).east(-7));

    list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos, rotation, "tofucastle_normalroom"));

    //east
    if (random.nextInt(1) == 0) {
        if (random.nextInt(1) == 0) {
            list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos1, rotation, "tofucastle_foodcontainer"));
        } else {
            list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos1, rotation, "tofucastle_foodcontainer2"));
        }
    } else {
        list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos1, rotation, "tofucastle_eastroom"));
    }


    //west
    if (random.nextInt(2) == 0) {
        list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos2, rotation, "tofucastle_westroom"));
    } else {
        list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos2, rotation, "tofucastle_westbedroom"));
    }
}
 
Example #13
Source File: TofuCastlePiece.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private TofuCastleTemplate(TemplateManager manager, BlockPos pos, Rotation rotation, Mirror mirror, String templateName) {
    super(0);
    this.templatePosition = pos;
    this.rotation = rotation;
    this.mirror = mirror;
    this.templateName = templateName;
    this.loadTemplate(manager);
}
 
Example #14
Source File: PositionUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Mirrors and then rotates the given position around the origin
 */
public static BlockPos getTransformedBlockPos(BlockPos pos, Mirror mirror, Rotation rotation)
{
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    boolean isMirrored = true;

    switch (mirror)
    {
        // LEFT_RIGHT is essentially NORTH_SOUTH
        case LEFT_RIGHT:
            z = -z;
            break;
        // FRONT_BACK is essentially EAST_WEST
        case FRONT_BACK:
            x = -x;
            break;
        default:
            isMirrored = false;
    }

    switch (rotation)
    {
        case CLOCKWISE_90:
            return new BlockPos(-z, y,  x);
        case COUNTERCLOCKWISE_90:
            return new BlockPos( z, y, -x);
        case CLOCKWISE_180:
            return new BlockPos(-x, y, -z);
        default:
            return isMirrored ? new BlockPos(x, y, z) : pos;
    }
}
 
Example #15
Source File: PositionUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Vec3d getTransformedPosition(Vec3d originalPos, Mirror mirror, Rotation rotation)
{
    double x = originalPos.x;
    double y = originalPos.y;
    double z = originalPos.z;
    boolean transformed = true;

    switch (mirror)
    {
        case LEFT_RIGHT:
            z = 1.0D - z;
            break;
        case FRONT_BACK:
            x = 1.0D - x;
            break;
        default:
            transformed = false;
    }

    switch (rotation)
    {
        case COUNTERCLOCKWISE_90:
            return new Vec3d(z, y, 1.0D - x);
        case CLOCKWISE_90:
            return new Vec3d(1.0D - z, y, x);
        case CLOCKWISE_180:
            return new Vec3d(1.0D - x, y, 1.0D - z);
        default:
            return transformed ? new Vec3d(x, y, z) : originalPos;
    }
}
 
Example #16
Source File: PositionUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static Rotation getReverseRotation(Rotation rotationIn)
{
    switch (rotationIn)
    {
        case COUNTERCLOCKWISE_90:
            return Rotation.CLOCKWISE_90;
        case CLOCKWISE_90:
            return Rotation.COUNTERCLOCKWISE_90;
        case CLOCKWISE_180:
            return Rotation.CLOCKWISE_180;
        default:
            return rotationIn;
    }
}
 
Example #17
Source File: TofuCastlePiece.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Override
protected void readStructureFromNBT(NBTTagCompound compound, TemplateManager manager) {
    super.readStructureFromNBT(compound, manager);
    this.isAleadyBossRoomGen = compound.getBoolean("BossRoom");
    this.templateName = compound.getString("Template");
    this.rotation = Rotation.valueOf(compound.getString("Rot"));
    this.mirror = Mirror.valueOf(compound.getString("Mi"));
    this.loadTemplate(manager);
}
 
Example #18
Source File: PositionUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static String getRotationNameShort(Rotation rotation)
{
    switch (rotation)
    {
        case CLOCKWISE_90:          return "CW_90";
        case CLOCKWISE_180:         return "CW_180";
        case COUNTERCLOCKWISE_90:   return "CCW_90";
        case NONE:
        default:                    return "NONE";
    }
}
 
Example #19
Source File: PositionUtils.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Mirrors and then rotates the given position around the origin
 */
public static BlockPosEU getTransformedBlockPos(BlockPosEU pos, Mirror mirror, Rotation rotation)
{
    int x = pos.getX();
    int y = pos.getY();
    int z = pos.getZ();
    boolean isMirrored = true;

    switch (mirror)
    {
        // LEFT_RIGHT is essentially NORTH_SOUTH
        case LEFT_RIGHT:
            z = -z;
            break;
        // FRONT_BACK is essentially EAST_WEST
        case FRONT_BACK:
            x = -x;
            break;
        default:
            isMirrored = false;
    }

    switch (rotation)
    {
        case CLOCKWISE_90:
            return new BlockPosEU(-z, y,  x, pos.getDimension(), pos.getFacing());
        case COUNTERCLOCKWISE_90:
            return new BlockPosEU( z, y, -x, pos.getDimension(), pos.getFacing());
        case CLOCKWISE_180:
            return new BlockPosEU(-x, y, -z, pos.getDimension(), pos.getFacing());
        default:
            return isMirrored ? new BlockPosEU(x, y, z, pos.getDimension(), pos.getFacing()) : pos;
    }
}
 
Example #20
Source File: MixinBlockRail.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Inject(method = "withRotation", at = @At("HEAD"), cancellable = true)
private void fixRailRotation(IBlockState state, Rotation rot, CallbackInfoReturnable<IBlockState> cir)
{
    if (Configs.Generic.FIX_RAIL_ROTATION.getBooleanValue() && rot == Rotation.CLOCKWISE_180)
    {
        BlockRailBase.EnumRailDirection dir = null;

        if (((Object) this) instanceof BlockRail)
        {
            dir = state.getValue(BlockRail.SHAPE);
        }
        else if (((Object) this) instanceof BlockRailDetector)
        {
            dir = state.getValue(BlockRailDetector.SHAPE);
        }
        else if (((Object) this) instanceof BlockRailPowered)
        {
            dir = state.getValue(BlockRailPowered.SHAPE);
        }

        // Fix the incomplete switch statement causing the ccw_90 rotation being used instead
        // for the 180 degree rotation of the straight rails.
        if (dir == BlockRailBase.EnumRailDirection.EAST_WEST || dir == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
        {
            cir.setReturnValue(state);
            cir.cancel();
        }
    }
}
 
Example #21
Source File: SchematicPlacementManager.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setRotation(SchematicPlacement placement, Rotation rotation, IMessageConsumer feedback)
{
    if (placement.isLocked())
    {
        feedback.addMessage(MessageType.ERROR, "litematica.message.placement.cant_modify_is_locked");
        return;
    }

    if (placement.getRotation() != rotation)
    {
        this.onPrePlacementChange(placement);
        placement.setRotation(rotation);
        this.onPlacementModified(placement);
    }
}
 
Example #22
Source File: SubRegionPlacement.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
void resetToOriginalValues()
{
    this.pos = this.defaultPos;
    this.rotation = Rotation.NONE;
    this.mirror = Mirror.NONE;
    this.enabled = true;
    this.ignoreEntities = false;
}
 
Example #23
Source File: SubRegionPlacement.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public boolean isRegionPlacementModified(BlockPos originalPosition)
{
    return this.isEnabled() == false ||
           this.ignoreEntities() ||
           this.getMirror() != Mirror.NONE ||
           this.getRotation() != Rotation.NONE ||
           this.getPos().equals(originalPosition) == false;
}
 
Example #24
Source File: SchematicPlacement.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
void setSubRegionRotation(String regionName, Rotation rotation)
{
    SubRegionPlacement subRegion = this.relativeSubRegionPlacements.get(regionName);

    if (subRegion != null)
    {
        subRegion.setRotation(rotation);
    }
}
 
Example #25
Source File: SchematicUtils.java    From litematica with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static IBlockState getUntransformedBlockState(IBlockState state, SchematicPlacement schematicPlacement, String subRegionName)
{
    SubRegionPlacement placement = schematicPlacement.getRelativeSubRegionPlacement(subRegionName);

    if (placement != null)
    {
        final Rotation rotationCombined = PositionUtils.getReverseRotation(schematicPlacement.getRotation().add(placement.getRotation()));
        final Mirror mirrorMain = schematicPlacement.getMirror();
        Mirror mirrorSub = placement.getMirror();

        if (mirrorSub != Mirror.NONE &&
            (schematicPlacement.getRotation() == Rotation.CLOCKWISE_90 ||
             schematicPlacement.getRotation() == Rotation.COUNTERCLOCKWISE_90))
        {
            mirrorSub = mirrorSub == Mirror.FRONT_BACK ? Mirror.LEFT_RIGHT : Mirror.FRONT_BACK;
        }

        if (rotationCombined != Rotation.NONE)
        {
            state = state.withRotation(rotationCombined);
        }

        if (mirrorSub != Mirror.NONE)
        {
            state = state.withMirror(mirrorSub);
        }

        if (mirrorMain != Mirror.NONE)
        {
            state = state.withMirror(mirrorMain);
        }
    }

    return state;
}
 
Example #26
Source File: TaskMoveArea.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
public TaskMoveArea(int dimension, BlockPos posSrcStart, BlockPos posSrcEnd, BlockPos posDstStart,
        Rotation rotationDst, Mirror mirrorDst, UUID wandUUID, int blocksPerTick)
{
    this.posSrcStart = posSrcStart;
    this.posDstStart = posDstStart;
    this.rotation = rotationDst;
    this.mirror = mirrorDst;
    this.wandUUID = wandUUID;
    this.dimension = dimension;
    this.blocksPerTick = blocksPerTick;
    this.boxRelative = new BlockPosBox(BlockPos.ORIGIN, posSrcEnd.subtract(posSrcStart));
    this.boxSource = new BlockPosBox(posSrcStart, posSrcEnd);
    this.handledPositions = new HashSet<BlockPos>();
}
 
Example #27
Source File: BlockEnderStorage.java    From EnderStorage with MIT License 5 votes vote down vote up
@Override
public BlockState rotate(BlockState state, IWorld world, BlockPos pos, Rotation direction) {
    TileEntity tile = world.getTileEntity(pos);
    if (tile instanceof TileFrequencyOwner) {
        ((TileFrequencyOwner) tile).rotate();
    }
    return state;
}
 
Example #28
Source File: BlockEnderUtilitiesTileEntity.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
{
    TileEntityEnderUtilities te = getTileEntitySafely(world, pos, TileEntityEnderUtilities.class);

    if (te != null)
    {
        te.rotate(Rotation.CLOCKWISE_90);
        IBlockState state = world.getBlockState(pos).getActualState(world, pos);
        world.notifyBlockUpdate(pos, state, state, 3);
        return true;
    }

    return false;
}
 
Example #29
Source File: TofuCastlePiece.java    From TofuCraftReload with MIT License 5 votes vote down vote up
private static void generateUnderGround(TemplateManager templateManager, BlockPos pos, Rotation rotation, List<TofuCastleTemplate> list, Random random) {
    BlockPos pos1 = new BlockPos(pos.down(19));

    BlockPos pos2 = new BlockPos(pos1.south(23).east(4));
    BlockPos pos3 = new BlockPos(pos1.south(-15).east(4));

    BlockPos pos4 = new BlockPos(pos1.south(23 + 15).down(11));

    generateUnderSub(templateManager, pos2, rotation, list, random);
    generateUnderSub(templateManager, pos3, rotation, list, random);

    list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos1, rotation, "tofucastle_undermain"));
    list.add(new TofuCastlePiece.TofuCastleTemplate(templateManager, pos4, rotation, "tofucastle_bossroom"));
}
 
Example #30
Source File: SubRegionPlacement.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nullable
public static SubRegionPlacement fromJson(JsonObject obj)
{
    if (JsonUtils.hasArray(obj, "pos") &&
        JsonUtils.hasString(obj, "name") &&
        JsonUtils.hasString(obj, "rotation") &&
        JsonUtils.hasString(obj, "mirror"))
    {
        BlockPos pos = JsonUtils.blockPosFromJson(obj, "pos");

        if (pos == null)
        {
            Litematica.logger.warn("Placement.fromJson(): Failed to load a placement from JSON, invalid position data");
            return null;
        }

        BlockPos defaultPos = JsonUtils.blockPosFromJson(obj, "default_pos");

        if (defaultPos == null)
        {
            defaultPos = pos;
        }

        SubRegionPlacement placement = new SubRegionPlacement(pos, defaultPos, obj.get("name").getAsString());
        placement.setEnabled(JsonUtils.getBoolean(obj, "enabled"));
        placement.ignoreEntities = JsonUtils.getBoolean(obj, "ignore_entities");
        placement.coordinateLockMask = JsonUtils.getInteger(obj, "locked_coords");

        try
        {
            Rotation rotation = Rotation.valueOf(obj.get("rotation").getAsString());
            Mirror mirror = Mirror.valueOf(obj.get("mirror").getAsString());

            placement.setRotation(rotation);
            placement.setMirror(mirror);
        }
        catch (Exception e)
        {
            Litematica.logger.warn("Placement.fromJson(): Invalid rotation or mirror value for a placement");
        }

        return placement;
    }

    return null;
}