PaperMC/nms-patches/CommandSpreadPlayers.patch
2020-06-25 10:00:00 +10:00

42 lines
2 KiB
Diff

--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
@@ -61,7 +61,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getScoreboardTeam());
} else {
- set.add((Object) null);
+ set.add((ScoreboardTeamBase) null); // CraftBukkit - decompile error
}
}
@@ -270,7 +270,7 @@
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
blockposition_mutableblockposition.c(EnumDirection.DOWN);
- flag1 = iblockaccess.getType(blockposition_mutableblockposition).isAir();
+ flag1 = getType(iblockaccess, blockposition_mutableblockposition).isAir(); // CraftBukkit
if (!flag1 && flag2 && flag) {
return blockposition_mutableblockposition.getY() + 1;
}
@@ -283,7 +283,7 @@
public boolean b(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
- IBlockData iblockdata = iblockaccess.getType(blockposition);
+ IBlockData iblockdata = getType(iblockaccess, blockposition); // CraftBukkit
Material material = iblockdata.getMaterial();
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
@@ -293,5 +293,12 @@
this.a = MathHelper.a(random, d0, d2);
this.b = MathHelper.a(random, d1, d3);
}
+
+ // CraftBukkit start - add a version of getType which force loads chunks
+ private static IBlockData getType(IBlockAccess iblockaccess, BlockPosition position) {
+ ((WorldServer) iblockaccess).getChunkProvider().getChunkAt(position.getX() >> 4, position.getZ() >> 4, true);
+ return iblockaccess.getType(position);
+ }
+ // CraftBukkit end
}
}