diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/WorldBorderCommand.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/WorldBorderCommand.java.patch | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/WorldBorderCommand.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/WorldBorderCommand.java.patch new file mode 100644 index 0000000000..62a4be2c2b --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/WorldBorderCommand.java.patch @@ -0,0 +1,122 @@ +--- a/net/minecraft/server/commands/WorldBorderCommand.java ++++ b/net/minecraft/server/commands/WorldBorderCommand.java +@@ -137,9 +57,10 @@ + } + + private static int setDamageBuffer(CommandSourceStack source, float distance) throws CommandSyntaxException { +- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder(); +- if (worldBorder.getDamageSafeZone() == (double)distance) { +- throw ERROR_SAME_DAMAGE_BUFFER.create(); ++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit ++ ++ if (worldborder.getDamageSafeZone() == (double) distance) { ++ throw WorldBorderCommand.ERROR_SAME_DAMAGE_BUFFER.create(); + } else { + worldBorder.setDamageSafeZone((double)distance); + source.sendSuccess(() -> Component.translatable("commands.worldborder.damage.buffer.success", String.format(Locale.ROOT, "%.2f", distance)), true); +@@ -148,9 +71,10 @@ + } + + private static int setDamageAmount(CommandSourceStack source, float damagePerBlock) throws CommandSyntaxException { +- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder(); +- if (worldBorder.getDamagePerBlock() == (double)damagePerBlock) { +- throw ERROR_SAME_DAMAGE_AMOUNT.create(); ++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit ++ ++ if (worldborder.getDamagePerBlock() == (double) damagePerBlock) { ++ throw WorldBorderCommand.ERROR_SAME_DAMAGE_AMOUNT.create(); + } else { + worldBorder.setDamagePerBlock((double)damagePerBlock); + source.sendSuccess( +@@ -161,9 +85,10 @@ + } + + private static int setWarningTime(CommandSourceStack source, int time) throws CommandSyntaxException { +- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder(); +- if (worldBorder.getWarningTime() == time) { +- throw ERROR_SAME_WARNING_TIME.create(); ++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit ++ ++ if (worldborder.getWarningTime() == time) { ++ throw WorldBorderCommand.ERROR_SAME_WARNING_TIME.create(); + } else { + worldBorder.setWarningTime(time); + source.sendSuccess(() -> Component.translatable("commands.worldborder.warning.time.success", time), true); +@@ -172,9 +99,10 @@ + } + + private static int setWarningDistance(CommandSourceStack source, int distance) throws CommandSyntaxException { +- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder(); +- if (worldBorder.getWarningBlocks() == distance) { +- throw ERROR_SAME_WARNING_DISTANCE.create(); ++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit ++ ++ if (worldborder.getWarningBlocks() == distance) { ++ throw WorldBorderCommand.ERROR_SAME_WARNING_DISTANCE.create(); + } else { + worldBorder.setWarningBlocks(distance); + source.sendSuccess(() -> Component.translatable("commands.worldborder.warning.distance.success", distance), true); +@@ -183,38 +113,40 @@ + } + + private static int getSize(CommandSourceStack source) { +- double size = source.getServer().overworld().getWorldBorder().getSize(); +- source.sendSuccess(() -> Component.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", size)), false); +- return Mth.floor(size + 0.5); ++ double d0 = source.getLevel().getWorldBorder().getSize(); // CraftBukkit ++ ++ source.sendSuccess(() -> { ++ return Component.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0)); ++ }, false); ++ return Mth.floor(d0 + 0.5D); + } + + private static int setCenter(CommandSourceStack source, Vec2 pos) throws CommandSyntaxException { +- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder(); +- if (worldBorder.getCenterX() == (double)pos.x && worldBorder.getCenterZ() == (double)pos.y) { +- throw ERROR_SAME_CENTER.create(); +- } else if (!((double)Math.abs(pos.x) > 2.9999984E7) && !((double)Math.abs(pos.y) > 2.9999984E7)) { +- worldBorder.setCenter((double)pos.x, (double)pos.y); +- source.sendSuccess( +- () -> Component.translatable( +- "commands.worldborder.center.success", String.format(Locale.ROOT, "%.2f", pos.x), String.format(Locale.ROOT, "%.2f", pos.y) +- ), +- true +- ); ++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit ++ ++ if (worldborder.getCenterX() == (double) pos.x && worldborder.getCenterZ() == (double) pos.y) { ++ throw WorldBorderCommand.ERROR_SAME_CENTER.create(); ++ } else if ((double) Math.abs(pos.x) <= 2.9999984E7D && (double) Math.abs(pos.y) <= 2.9999984E7D) { ++ worldborder.setCenter((double) pos.x, (double) pos.y); ++ source.sendSuccess(() -> { ++ return Component.translatable("commands.worldborder.center.success", String.format(Locale.ROOT, "%.2f", pos.x), String.format(Locale.ROOT, "%.2f", pos.y)); ++ }, true); + return 0; + } else { + throw ERROR_TOO_FAR_OUT.create(); + } + } + +- private static int setSize(CommandSourceStack source, double newSize, long time) throws CommandSyntaxException { +- WorldBorder worldBorder = source.getServer().overworld().getWorldBorder(); +- double size = worldBorder.getSize(); +- if (size == newSize) { +- throw ERROR_SAME_SIZE.create(); +- } else if (newSize < 1.0) { +- throw ERROR_TOO_SMALL.create(); +- } else if (newSize > 5.999997E7F) { +- throw ERROR_TOO_BIG.create(); ++ private static int setSize(CommandSourceStack source, double newSize, long i) throws CommandSyntaxException { ++ WorldBorder worldborder = source.getLevel().getWorldBorder(); // CraftBukkit ++ double d1 = worldborder.getSize(); ++ ++ if (d1 == newSize) { ++ throw WorldBorderCommand.ERROR_SAME_SIZE.create(); ++ } else if (newSize < 1.0D) { ++ throw WorldBorderCommand.ERROR_TOO_SMALL.create(); ++ } else if (newSize > 5.9999968E7D) { ++ throw WorldBorderCommand.ERROR_TOO_BIG.create(); + } else { + if (time > 0L) { + worldBorder.lerpSizeBetween(size, newSize, time); |