PaperMC/nms-patches/CommandSpreadPlayers.patch

52 lines
2 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
2016-05-10 13:47:39 +02:00
@@ -236,9 +236,16 @@
2016-02-29 22:32:46 +01:00
}
2016-05-10 13:47:39 +02:00
public List<String> tabComplete(MinecraftServer minecraftserver, ICommandListener icommandlistener, String[] astring, @Nullable BlockPosition blockposition) {
2016-02-29 22:32:46 +01:00
- return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.emptyList();
+ return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : Collections.<String>emptyList(); // CraftBukkit - decompile error
2015-02-26 23:41:06 +01:00
}
+ // CraftBukkit start - fix decompile error
+ @Override
+ public int compareTo(ICommand o) {
+ return a(o);
+ }
+ // CraftBukkit end
+
static class Location2D {
double a;
2016-05-10 13:47:39 +02:00
@@ -305,7 +312,7 @@
2015-02-26 23:41:06 +01:00
}
blockposition = blockposition.down();
2016-02-29 22:32:46 +01:00
- } while (world.getType(blockposition).getMaterial() == Material.AIR);
+ } while (getType(world, blockposition).getMaterial() == Material.AIR); // CraftBukkit
2015-02-26 23:41:06 +01:00
return blockposition.getY() + 1;
}
2016-05-10 13:47:39 +02:00
@@ -321,7 +328,7 @@
2015-02-26 23:41:06 +01:00
}
blockposition = blockposition.down();
2016-02-29 22:32:46 +01:00
- material = world.getType(blockposition).getMaterial();
+ material = getType(world, blockposition).getMaterial(); // CraftBukkit
2015-02-26 23:41:06 +01:00
} while (material == Material.AIR);
return !material.isLiquid() && material != Material.FIRE;
2016-05-10 13:47:39 +02:00
@@ -331,5 +338,12 @@
2015-02-26 23:41:06 +01:00
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(World world, BlockPosition position) {
+ ((ChunkProviderServer) world.chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4);
+ return world.getType(position);
+ }
+ // CraftBukkit end
}
}