mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-04 14:04:49 +01:00
SPIGOT-4446: Legacy rotation methods don't work for wall mounted skulls
This commit is contained in:
parent
4a47be6164
commit
d6b57bd963
1 changed files with 10 additions and 3 deletions
|
@ -12,6 +12,8 @@ import org.bukkit.SkullType;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Skull;
|
import org.bukkit.block.Skull;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.block.data.Directional;
|
||||||
import org.bukkit.block.data.Rotatable;
|
import org.bukkit.block.data.Rotatable;
|
||||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||||
|
|
||||||
|
@ -106,13 +108,18 @@ public class CraftSkull extends CraftBlockEntityState<TileEntitySkull> implement
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockFace getRotation() {
|
public BlockFace getRotation() {
|
||||||
return ((Rotatable) getBlockData()).getRotation();
|
BlockData blockData = getBlockData();
|
||||||
|
return (blockData instanceof Rotatable) ? ((Rotatable) blockData).getRotation() : ((Directional) blockData).getFacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotation(BlockFace rotation) {
|
public void setRotation(BlockFace rotation) {
|
||||||
Rotatable blockData = (Rotatable) getBlockData();
|
BlockData blockData = getBlockData();
|
||||||
blockData.setRotation(rotation);
|
if (blockData instanceof Rotatable) {
|
||||||
|
((Rotatable) blockData).setRotation(rotation);
|
||||||
|
} else {
|
||||||
|
((Directional) blockData).setFacing(rotation);
|
||||||
|
}
|
||||||
setBlockData(blockData);
|
setBlockData(blockData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue