From 257f5ad3e8d645db0957ce7d47e29b6755a85977 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 2 Apr 2023 13:32:01 +1000 Subject: [PATCH] #1162: Add BlockData#rotate and BlockData#mirror By: Jishuna --- .../craftbukkit/block/data/CraftBlockData.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java index 9925b78f1f..98dd212b23 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -17,6 +17,8 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.INamable; import net.minecraft.world.level.BlockAccessAir; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EnumBlockMirror; +import net.minecraft.world.level.block.EnumBlockRotation; import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockDataHolder; import net.minecraft.world.level.block.state.properties.BlockStateBoolean; @@ -30,6 +32,8 @@ import org.bukkit.block.BlockFace; import org.bukkit.block.BlockSupport; import org.bukkit.block.PistonMoveReaction; import org.bukkit.block.data.BlockData; +import org.bukkit.block.structure.Mirror; +import org.bukkit.block.structure.StructureRotation; import org.bukkit.craftbukkit.CraftSoundGroup; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CraftBlock; @@ -622,4 +626,14 @@ public class CraftBlockData implements BlockData { public Material getPlacementMaterial() { return CraftMagicNumbers.getMaterial(state.getBlock().asItem()); } + + @Override + public void rotate(StructureRotation rotation) { + this.state = state.rotate(EnumBlockRotation.valueOf(rotation.name())); + } + + @Override + public void mirror(Mirror mirror) { + this.state = state.mirror(EnumBlockMirror.valueOf(mirror.name())); + } }