Update to Minecraft 1.18-pre5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2021-11-22 09:00:00 +11:00
parent a852b81a69
commit 43702a9e10
700 changed files with 10286 additions and 10098 deletions

View File

@@ -18,57 +18,57 @@
+ BlockStateListPopulator blockList = new BlockStateListPopulator(world); // CraftBukkit - Use BlockStateListPopulator
if (shapedetector_shapedetectorcollection != null) {
for (i = 0; i < this.getSnowmanShape().b(); ++i) {
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0);
for (i = 0; i < this.getOrCreateSnowGolemFull().getHeight(); ++i) {
ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.getBlock(0, i, 0);
- 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
- world.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2);
- world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState()));
+ blockList.setBlock(shapedetectorblock.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
+ // world.levelEvent(2001, shapedetectorblock.getPos(), Block.getId(shapedetectorblock.getState())); // CraftBukkit
}
EntitySnowman entitysnowman = (EntitySnowman) EntityTypes.SNOW_GOLEM.a(world);
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition();
EntitySnowman entitysnowman = (EntitySnowman) EntityTypes.SNOW_GOLEM.create(world);
BlockPosition blockposition1 = shapedetector_shapedetectorcollection.getBlock(0, 2, 0).getPos();
entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
- world.addEntity(entitysnowman);
entitysnowman.moveTo((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F);
- world.addFreshEntity(entitysnowman);
+ // CraftBukkit start
+ if (!world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
+ if (!world.addFreshEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) {
+ return;
+ }
+ for (BlockPosition pos : blockList.getBlocks()) {
+ world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos)));
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
+ }
+ blockList.updateList();
+ // CraftBukkit end
iterator = world.a(EntityPlayer.class, entitysnowman.getBoundingBox().g(5.0D)).iterator();
iterator = world.getEntitiesOfClass(EntityPlayer.class, entitysnowman.getBoundingBox().inflate(5.0D)).iterator();
while (iterator.hasNext()) {
@@ -96,8 +110,8 @@
for (int k = 0; k < this.getIronGolemShape().b(); ++k) {
ShapeDetectorBlock shapedetectorblock2 = shapedetector_shapedetectorcollection.a(i, k, 0);
for (int k = 0; k < this.getOrCreateIronGolemFull().getHeight(); ++k) {
ShapeDetectorBlock shapedetectorblock2 = shapedetector_shapedetectorcollection.getBlock(i, k, 0);
- world.setTypeAndData(shapedetectorblock2.getPosition(), Blocks.AIR.getBlockData(), 2);
- world.triggerEffect(2001, shapedetectorblock2.getPosition(), Block.getCombinedId(shapedetectorblock2.a()));
+ blockList.setTypeAndData(shapedetectorblock2.getPosition(), Blocks.AIR.getBlockData(), 2); // CraftBukkit
+ // world.triggerEffect(2001, shapedetectorblock2.getPosition(), Block.getCombinedId(shapedetectorblock2.a())); // CraftBukkit
- world.setBlock(shapedetectorblock2.getPos(), Blocks.AIR.defaultBlockState(), 2);
- world.levelEvent(2001, shapedetectorblock2.getPos(), Block.getId(shapedetectorblock2.getState()));
+ blockList.setBlock(shapedetectorblock2.getPos(), Blocks.AIR.defaultBlockState(), 2); // CraftBukkit
+ // world.levelEvent(2001, shapedetectorblock2.getPos(), Block.getId(shapedetectorblock2.getState())); // CraftBukkit
}
}
@@ -106,7 +120,15 @@
entityirongolem.setPlayerCreated(true);
entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
- world.addEntity(entityirongolem);
entityirongolem.moveTo((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F);
- world.addFreshEntity(entityirongolem);
+ // CraftBukkit start
+ if (!world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
+ if (!world.addFreshEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) {
+ return;
+ }
+ for (BlockPosition pos : blockList.getBlocks()) {
+ world.triggerEffect(2001, pos, Block.getCombinedId(world.getType(pos)));
+ world.levelEvent(2001, pos, Block.getId(world.getBlockState(pos)));
+ }
+ blockList.updateList();
+ // CraftBukkit end
iterator = world.a(EntityPlayer.class, entityirongolem.getBoundingBox().g(5.0D)).iterator();
iterator = world.getEntitiesOfClass(EntityPlayer.class, entityirongolem.getBoundingBox().inflate(5.0D)).iterator();
while (iterator.hasNext()) {