0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-22 10:06:16 +00:00
craftbukkit/nms-patches/net/minecraft/world/level/block/BlockWitherSkull.patch
2024-10-23 02:15:00 +11:00

51 lines
3.0 KiB
Diff

--- a/net/minecraft/world/level/block/BlockWitherSkull.java
+++ b/net/minecraft/world/level/block/BlockWitherSkull.java
@@ -26,6 +26,10 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBuilder;
import net.minecraft.world.level.block.state.predicate.BlockStatePredicate;
+// CraftBukkit start
+import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
+// CraftBukkit end
+
public class BlockWitherSkull extends BlockSkull {
public static final MapCodec<BlockWitherSkull> CODEC = simpleCodec(BlockWitherSkull::new);
@@ -58,6 +62,7 @@
}
public static void checkSpawn(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) {
+ if (world.captureBlockStates) return; // CraftBukkit
if (!world.isClientSide) {
IBlockData iblockdata = tileentityskull.getBlockState();
boolean flag = iblockdata.is(Blocks.WITHER_SKELETON_SKULL) || iblockdata.is(Blocks.WITHER_SKELETON_WALL_SKULL);
@@ -69,12 +74,18 @@
EntityWither entitywither = (EntityWither) EntityTypes.WITHER.create(world, EntitySpawnReason.TRIGGERED);
if (entitywither != null) {
- BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection);
+ // BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - move down
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.getBlock(1, 2, 0).getPos();
entitywither.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.55D, (double) blockposition1.getZ() + 0.5D, shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F, 0.0F);
entitywither.yBodyRot = shapedetector_shapedetectorcollection.getForwards().getAxis() == EnumDirection.EnumAxis.X ? 0.0F : 90.0F;
entitywither.makeInvulnerable();
+ // CraftBukkit start
+ if (!world.addFreshEntity(entitywither, SpawnReason.BUILD_WITHER)) {
+ return;
+ }
+ BlockPumpkinCarved.clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - from above
+ // CraftBukkit end
Iterator iterator = world.getEntitiesOfClass(EntityPlayer.class, entitywither.getBoundingBox().inflate(50.0D)).iterator();
while (iterator.hasNext()) {
@@ -83,7 +94,7 @@
CriterionTriggers.SUMMONED_ENTITY.trigger(entityplayer, (Entity) entitywither);
}
- world.addFreshEntity(entitywither);
+ // world.addFreshEntity(entitywither); // CraftBukkit - moved up
BlockPumpkinCarved.updatePatternBlocks(world, shapedetector_shapedetectorcollection);
}