3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 07:10:10 +01:00
Paper/nms-patches/BlockWitherSkull.patch

67 Zeilen
3.1 KiB
Diff

2018-07-15 02:00:00 +02:00
--- a/net/minecraft/server/BlockWitherSkull.java
+++ b/net/minecraft/server/BlockWitherSkull.java
@@ -3,6 +3,11 @@
import java.util.Iterator;
import javax.annotation.Nullable;
+// CraftBukkit start
+import org.bukkit.craftbukkit.util.BlockStateListPopulator;
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockWitherSkull extends BlockSkull {
private static ShapeDetector c;
@@ -23,6 +28,7 @@
}
public static void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
+ if (world.captureBlockStates) return; // CraftBukkit
Block block = tileentityskull.getBlock().getBlock();
boolean flag = block == Blocks.WITHER_SKELETON_SKULL || block == Blocks.WITHER_SKELETON_WALL_SKULL;
@@ -31,6 +37,8 @@
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition);
if (shapedetector_shapedetectorcollection != null) {
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world);
int i;
for (i = 0; i < 3; ++i) {
@@ -39,7 +47,7 @@
for (i = 0; i < shapedetector.c(); ++i) {
for (int j = 0; j < shapedetector.b(); ++j) {
- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, j, 0).getPosition(), Blocks.AIR.getBlockData(), 2);
+ blockList.setTypeAndData(shapedetector_shapedetectorcollection.a(i, j, 0).getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
}
}
@@ -50,6 +58,16 @@
entitywither.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.55D, (double) blockposition2.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.aQ = shapedetector_shapedetectorcollection.getFacing().k() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.l();
+ // CraftBukkit start
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ // Restore drop status from above
+ for (i = 0; i < 3; ++i) {
+ TileEntitySkull.setShouldDrop(world, shapedetector_shapedetectorcollection.a(i, 0, 0).getPosition(), true);
+ }
+ return;
+ }
+ blockList.updateList();
+ // CraftBukkit end
Iterator iterator = world.a(EntityPlayer.class, entitywither.getBoundingBox().g(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -58,7 +76,7 @@
CriterionTriggers.n.a(entityplayer, (Entity) entitywither);
}
- world.addEntity(entitywither);
+ // world.addEntity(entitywither); // CraftBukkit - moved up
int k;