3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-24 15:20:11 +01:00
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) {
2020-06-25 02:00:00 +02:00
IBlockData iblockdata = tileentityskull.getBlock();
boolean flag = iblockdata.a(Blocks.WITHER_SKELETON_SKULL) || iblockdata.a(Blocks.WITHER_SKELETON_WALL_SKULL);
2019-04-23 04:00:00 +02:00
@@ -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 @@
2020-06-25 02:00:00 +02:00
entitywither.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.aH = shapedetector_shapedetectorcollection.getFacing().n() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.beginSpawnSequence();
2019-04-23 04:00:00 +02:00
+ // 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) {