diff --git a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java index 34918d65c1..2503f9eff8 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java +++ b/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/world/SchematicCommand.java @@ -387,18 +387,22 @@ public void execute(final ScriptEntry scriptEntry) { scriptEntry.setFinished(true); return; } + final int angleRaw = angle.asInt(); + final CuboidBlockSet schematic = schematics.get(name.asString().toUpperCase()); Runnable rotateRunnable = () -> { - int ang = angle.asInt(); + int ang = angleRaw; while (ang < 0) { ang = 360 + ang; } while (ang >= 360) { ang -= 360; } - ang = 360 - ang; - while (ang > 0) { - ang -= 90; - schematics.get(name.asString().toUpperCase()).rotateOne(); + if (ang != 0) { + ang = 360 - ang; + while (ang > 0) { + ang -= 90; + schematic.rotateOne(); + } } Bukkit.getScheduler().runTask(Denizen.getInstance(), () -> scriptEntry.setFinished(true)); }; diff --git a/plugin/src/main/java/com/denizenscript/denizen/utilities/blocks/FullBlockData.java b/plugin/src/main/java/com/denizenscript/denizen/utilities/blocks/FullBlockData.java index 6d737002fd..ce7e1f8e50 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/utilities/blocks/FullBlockData.java +++ b/plugin/src/main/java/com/denizenscript/denizen/utilities/blocks/FullBlockData.java @@ -40,6 +40,12 @@ public FullBlockData(BlockData data) { this.data = data; } + public FullBlockData(BlockData data, CompoundTag tileEntityData, MapTag flags) { + this.data = data; + this.tileEntityData = tileEntityData; + this.flags = flags; + } + public static BlockFace rotateFaceOne(BlockFace face) { switch (face) { case NORTH: @@ -115,23 +121,23 @@ public FullBlockData rotateOne() { ((Orientable) newData).setAxis(Axis.X); break; } - return new FullBlockData(newData); + return new FullBlockData(newData, tileEntityData, flags); } else if (data instanceof Rotatable) { BlockData newData = data.clone(); ((Rotatable) newData).setRotation(rotateFaceOne(((Rotatable) data).getRotation())); - return new FullBlockData(newData); + return new FullBlockData(newData, tileEntityData, flags); } else if (data instanceof Directional) { BlockData newData = data.clone(); ((Directional) newData).setFacing(rotateFaceOne(((Directional) data).getFacing())); - return new FullBlockData(newData); + return new FullBlockData(newData, tileEntityData, flags); } else if (data instanceof Rail) { BlockData newData = data.clone(); ((Rail) newData).setShape(rotateRailShapeOne(((Rail) data).getShape())); - return new FullBlockData(newData); + return new FullBlockData(newData, tileEntityData, flags); } return this; }