13
0
geforkt von Mirrors/Paper
Paper/nms-patches/BlockWitherSkull.patch

65 Zeilen
3.5 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 {
2019-04-23 04:00:00 +02:00
@Nullable
@@ -26,6 +31,7 @@
2018-07-15 02:00:00 +02:00
}
public static void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
+ if (world.captureBlockStates) return; // CraftBukkit
2019-04-23 04:00:00 +02:00
if (!world.isClientSide) {
Block block = tileentityskull.getBlock().getBlock();
boolean flag = block == Blocks.WITHER_SKELETON_SKULL || block == Blocks.WITHER_SKELETON_WALL_SKULL;
@@ -35,12 +41,14 @@
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition);
2018-07-15 02:00:00 +02:00
2019-04-23 04:00:00 +02:00
if (shapedetector_shapedetectorcollection != null) {
+ // CraftBukkit start - Use BlockStateListPopulator
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world);
for (int i = 0; i < shapedetector.c(); ++i) {
for (int j = 0; j < shapedetector.b(); ++j) {
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(i, j, 0);
2018-07-15 02:00:00 +02:00
2019-04-23 04:00:00 +02:00
- world.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2);
- world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a()));
+ blockList.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
+ // world.triggerEffect(2001, shapedetectorblock.getPosition(), Block.getCombinedId(shapedetectorblock.a())); // CraftBukkit
}
2018-07-15 02:00:00 +02:00
}
2019-04-23 04:00:00 +02:00
@@ -50,6 +58,15 @@
2019-12-10 23:00:00 +01:00
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.aI = shapedetector_shapedetectorcollection.getFacing().m() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
2019-04-23 04:00:00 +02:00
entitywither.l();
+ // CraftBukkit start
+ if (!world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ return;
2018-07-15 02:00:00 +02:00
+ }
2019-04-23 04:00:00 +02:00
+ for (BlockPosition pos : blockList.getBlocks()) {
+ world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos)));
+ }
+ blockList.updateList();
+ // CraftBukkit end
Iterator iterator = world.a(EntityPlayer.class, entitywither.getBoundingBox().g(50.0D)).iterator();
2018-07-15 02:00:00 +02:00
2019-04-23 04:00:00 +02:00
while (iterator.hasNext()) {
@@ -58,7 +75,7 @@
CriterionTriggers.n.a(entityplayer, (Entity) entitywither);
}
2018-07-15 02:00:00 +02:00
2019-04-23 04:00:00 +02:00
- world.addEntity(entitywither);
+ // world.addEntity(entitywither); // CraftBukkit - moved up
2018-07-15 02:00:00 +02:00
2019-04-23 04:00:00 +02:00
for (int k = 0; k < shapedetector.c(); ++k) {
for (int l = 0; l < shapedetector.b(); ++l) {