SPIGOT-206 Further checks and fixes for Hanging entities.
Adds an check for existing entities before selecting the location allowing for hanging entities to be spawned in blocks where there already is an hanging entity at the default rotation. Fixes the CraftHanging setRotation function to use the new 1.8 logic. By: Stefan <admin@fearthe1337.com>
This commit is contained in:
@@ -23,11 +23,8 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
||||
}
|
||||
|
||||
public boolean setFacingDirection(BlockFace face, boolean force) {
|
||||
Block block = getLocation().getBlock().getRelative(getAttachedFace()).getRelative(face.getOppositeFace()).getRelative(getFacing());
|
||||
EntityHanging hanging = getHandle();
|
||||
BlockPosition old = hanging.getBlockPosition();
|
||||
EnumDirection dir = hanging.direction;
|
||||
hanging.blockPosition = new BlockPosition(block.getX(), block.getY(), block.getZ());
|
||||
switch (face) {
|
||||
case SOUTH:
|
||||
default:
|
||||
@@ -45,7 +42,6 @@ public class CraftHanging extends CraftEntity implements Hanging {
|
||||
}
|
||||
if (!force && !hanging.survives()) {
|
||||
// Revert since it doesn't fit
|
||||
hanging.blockPosition = old;
|
||||
hanging.setDirection(dir);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user