Commits

md_5 authored 1fe19a83f9c
SPIGOT-1129: Fix spawning leash hitch without adjacent block
No tags

src/main/java/org/bukkit/craftbukkit/CraftWorld.java

Modified
1085 1085 }
1086 1086 }
1087 1087
1088 1088 if (!taken) {
1089 1089 face = dir;
1090 1090 break;
1091 1091 }
1092 1092 }
1093 1093 }
1094 1094
1095 - EnumDirection dir = CraftBlock.blockFaceToNotch(face).opposite();
1096 - if (Painting.class.isAssignableFrom(clazz)) {
1097 - entity = new EntityPainting(world, new BlockPosition((int) x, (int) y, (int) z), dir);
1098 - } else if (ItemFrame.class.isAssignableFrom(clazz)) {
1099 - entity = new EntityItemFrame(world, new BlockPosition((int) x, (int) y, (int) z), dir);
1100 - } else if (LeashHitch.class.isAssignableFrom(clazz)) {
1095 + if (LeashHitch.class.isAssignableFrom(clazz)) {
1101 1096 entity = new EntityLeash(world, new BlockPosition((int) x, (int) y, (int) z));
1102 1097 entity.attachedToPlayer = true;
1098 + } else {
1099 + EnumDirection dir = CraftBlock.blockFaceToNotch(face).opposite();
1100 + if (Painting.class.isAssignableFrom(clazz)) {
1101 + entity = new EntityPainting(world, new BlockPosition((int) x, (int) y, (int) z), dir);
1102 + } else if (ItemFrame.class.isAssignableFrom(clazz)) {
1103 + entity = new EntityItemFrame(world, new BlockPosition((int) x, (int) y, (int) z), dir);
1104 + }
1103 1105 }
1104 1106
1105 1107 if (entity != null && !((EntityHanging) entity).survives()) {
1106 1108 throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location);
1107 1109 }
1108 1110 } else if (TNTPrimed.class.isAssignableFrom(clazz)) {
1109 1111 entity = new EntityTNTPrimed(world, x, y, z, null);
1110 1112 } else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
1111 1113 entity = new EntityExperienceOrb(world, x, y, z, 0);
1112 1114 } else if (Weather.class.isAssignableFrom(clazz)) {

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut