SPIGOT-4147: Fix ItemFrames not able to be placed UP or DOWN

Dieser Commit ist enthalten in:
Senmori 2018-07-24 18:41:49 -04:00 committet von md_5
Ursprung 88d89792fc
Commit 9646d8d780
2 geänderte Dateien mit 12 neuen und 14 gelöschten Zeilen

Datei anzeigen

@ -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

Datei anzeigen

@ -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;
}