diff options
author | Senmori <thesenmori@gmail.com> | 2018-07-24 18:41:49 -0400 |
---|---|---|
committer | md_5 <git@md-5.net> | 2018-07-25 14:17:03 +1000 |
commit | 9646d8d7800931effa31be173fda765ecdf996c4 (patch) | |
tree | 0d67de28a0c478c225263717acdac277df95f6a8 /src/main | |
parent | 88d89792fc14b2b17344d7f7250b62e555ba604f (diff) | |
download | craftbukkit-9646d8d7800931effa31be173fda765ecdf996c4.tar craftbukkit-9646d8d7800931effa31be173fda765ecdf996c4.tar.gz craftbukkit-9646d8d7800931effa31be173fda765ecdf996c4.tar.lz craftbukkit-9646d8d7800931effa31be173fda765ecdf996c4.tar.xz craftbukkit-9646d8d7800931effa31be173fda765ecdf996c4.zip |
SPIGOT-4147: Fix ItemFrames not able to be placed UP or DOWN
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java | 15 | ||||
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java | 11 |
2 files changed, 12 insertions, 14 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java index 411c023d..d9a871a8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHanging.java @@ -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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java index 95647efc..75812a58 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -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; } |