PaperMC/paper-server/nms-patches/net/minecraft/server/commands/CommandSpreadPlayers.patch
CraftBukkit/Spigot 9d740b84b0 Update to Minecraft 1.20
By: md_5 <git@md-5.net>
2023-06-08 01:30:00 +10:00

51 lines
3 KiB
Diff

--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
@@ -92,7 +92,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getTeam());
} else {
- set.add((Object) null);
+ set.add((ScoreboardTeamBase) null); // CraftBukkit - decompile error
}
}
@@ -202,7 +202,7 @@
commandspreadplayers_a = acommandspreadplayers_a[j++];
}
- entity.teleportTo(worldserver, (double) MathHelper.floor(commandspreadplayers_a.x) + 0.5D, (double) commandspreadplayers_a.getSpawnY(worldserver, i), (double) MathHelper.floor(commandspreadplayers_a.z) + 0.5D, Set.of(), entity.getYRot(), entity.getXRot());
+ entity.teleportTo(worldserver, (double) MathHelper.floor(commandspreadplayers_a.x) + 0.5D, (double) commandspreadplayers_a.getSpawnY(worldserver, i), (double) MathHelper.floor(commandspreadplayers_a.z) + 0.5D, Set.of(), entity.getYRot(), entity.getXRot(), org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit - handle teleport reason
d1 = Double.MAX_VALUE;
CommandSpreadPlayers.a[] acommandspreadplayers_a1 = acommandspreadplayers_a;
int k = acommandspreadplayers_a.length;
@@ -301,7 +301,7 @@
for (boolean flag2 = iblockaccess.getBlockState(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
blockposition_mutableblockposition.move(EnumDirection.DOWN);
- flag1 = iblockaccess.getBlockState(blockposition_mutableblockposition).isAir();
+ flag1 = getBlockState(iblockaccess, blockposition_mutableblockposition).isAir(); // CraftBukkit
if (!flag1 && flag2 && flag) {
return blockposition_mutableblockposition.getY() + 1;
}
@@ -314,7 +314,7 @@
public boolean isSafe(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = BlockPosition.containing(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
- IBlockData iblockdata = iblockaccess.getBlockState(blockposition);
+ IBlockData iblockdata = getBlockState(iblockaccess, blockposition); // CraftBukkit
return blockposition.getY() < i && !iblockdata.liquid() && !iblockdata.is(TagsBlock.FIRE);
}
@@ -323,5 +323,12 @@
this.x = MathHelper.nextDouble(randomsource, d0, d2);
this.z = MathHelper.nextDouble(randomsource, d1, d3);
}
+
+ // CraftBukkit start - add a version of getBlockState which force loads chunks
+ private static IBlockData getBlockState(IBlockAccess iblockaccess, BlockPosition position) {
+ ((WorldServer) iblockaccess).getChunkSource().getChunk(position.getX() >> 4, position.getZ() >> 4, true);
+ return iblockaccess.getBlockState(position);
+ }
+ // CraftBukkit end
}
}