mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 08:56:23 +01:00
SPIGOT-4147: Fix ItemFrames not able to be placed UP or DOWN
This commit is contained in:
parent
88d89792fc
commit
9646d8d780
2 changed files with 12 additions and 14 deletions
|
@ -1,11 +1,10 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.EntityHanging;
|
||||
import net.minecraft.server.EnumDirection;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Hanging;
|
||||
|
||||
|
@ -51,17 +50,7 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
|||
public BlockFace getFacing() {
|
||||
EnumDirection direction = this.getHandle().direction;
|
||||
if (direction == null) return BlockFace.SELF;
|
||||
switch (direction) {
|
||||
case SOUTH:
|
||||
default:
|
||||
return BlockFace.SOUTH;
|
||||
case WEST:
|
||||
return BlockFace.WEST;
|
||||
case NORTH:
|
||||
return BlockFace.NORTH;
|
||||
case EAST:
|
||||
return BlockFace.EAST;
|
||||
}
|
||||
return CraftBlock.notchToBlockFace(direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.EntityHanging;
|
||||
import net.minecraft.server.EntityItemFrame;
|
||||
import net.minecraft.server.EnumDirection;
|
||||
import net.minecraft.server.ItemStack;
|
||||
|
@ -12,6 +13,7 @@ import org.bukkit.Rotation;
|
|||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ItemFrame;
|
||||
|
@ -21,8 +23,15 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
|
|||
super(server, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||
if (!super.setFacingDirection(face, force)) {
|
||||
EntityHanging hanging = getHandle();
|
||||
EnumDirection oldDir = hanging.direction;
|
||||
EnumDirection newDir = CraftBlock.blockFaceToNotch(face);
|
||||
|
||||
getHandle().setDirection(newDir);
|
||||
if (!force && !hanging.survives()) {
|
||||
hanging.setDirection(oldDir);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue