mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-23 00:42:05 +01:00
#1162: Add BlockData#rotate and BlockData#mirror
By: Jishuna <joshl5324@gmail.com>
This commit is contained in:
parent
ad8f95c3df
commit
257f5ad3e8
1 changed files with 14 additions and 0 deletions
|
@ -17,6 +17,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.INamable;
|
import net.minecraft.util.INamable;
|
||||||
import net.minecraft.world.level.BlockAccessAir;
|
import net.minecraft.world.level.BlockAccessAir;
|
||||||
import net.minecraft.world.level.block.Block;
|
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.IBlockData;
|
||||||
import net.minecraft.world.level.block.state.IBlockDataHolder;
|
import net.minecraft.world.level.block.state.IBlockDataHolder;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
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.BlockSupport;
|
||||||
import org.bukkit.block.PistonMoveReaction;
|
import org.bukkit.block.PistonMoveReaction;
|
||||||
import org.bukkit.block.data.BlockData;
|
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.CraftSoundGroup;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
|
@ -622,4 +626,14 @@ public class CraftBlockData implements BlockData {
|
||||||
public Material getPlacementMaterial() {
|
public Material getPlacementMaterial() {
|
||||||
return CraftMagicNumbers.getMaterial(state.getBlock().asItem());
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue