aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-bee74680e607c2e29b038329f62181238911cd83.tar.gz
Paper-bee74680e607c2e29b038329f62181238911cd83.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
new file mode 100644
index 0000000000..52ffe0022a
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/ScheduleCommand.java.patch
@@ -0,0 +1,64 @@
+--- a/net/minecraft/server/commands/ScheduleCommand.java
++++ b/net/minecraft/server/commands/ScheduleCommand.java
+@@ -98,33 +53,34 @@
+ if (time == 0) {
+ throw ERROR_SAME_TICK.create();
+ } else {
+- long l = source.getLevel().getGameTime() + (long)time;
+- ResourceLocation resourceLocation = function.getFirst();
+- TimerQueue<MinecraftServer> scheduledEvents = source.getServer().getWorldData().overworldData().getScheduledEvents();
+- function.getSecond()
+- .ifLeft(
+- commandFunction -> {
+- String string = resourceLocation.toString();
+- if (append) {
+- scheduledEvents.remove(string);
+- }
+-
+- scheduledEvents.schedule(string, l, new FunctionCallback(resourceLocation));
+- source.sendSuccess(
+- () -> Component.translatable("commands.schedule.created.function", Component.translationArg(resourceLocation), time, l), true
+- );
+- }
+- )
+- .ifRight(functions -> {
+- String string = "#" + resourceLocation;
+- if (append) {
+- scheduledEvents.remove(string);
+- }
+-
+- scheduledEvents.schedule(string, l, new FunctionTagCallback(resourceLocation));
+- source.sendSuccess(() -> Component.translatable("commands.schedule.created.tag", Component.translationArg(resourceLocation), time, l), true);
+- });
+- return Math.floorMod(l, Integer.MAX_VALUE);
++ long j = source.getLevel().getGameTime() + (long) time;
++ ResourceLocation minecraftkey = (ResourceLocation) function.getFirst();
++ TimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = source.getLevel().serverLevelData.overworldData().getScheduledEvents(); // CraftBukkit - SPIGOT-6667: Use world specific function timer
++
++ ((Either) function.getSecond()).ifLeft((net_minecraft_commands_functions_commandfunction) -> {
++ String s = minecraftkey.toString();
++
++ if (append) {
++ customfunctioncallbacktimerqueue.remove(s);
++ }
++
++ customfunctioncallbacktimerqueue.schedule(s, j, new FunctionCallback(minecraftkey));
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.schedule.created.function", Component.translationArg(minecraftkey), time, j);
++ }, true);
++ }).ifRight((collection) -> {
++ String s = "#" + minecraftkey;
++
++ if (append) {
++ customfunctioncallbacktimerqueue.remove(s);
++ }
++
++ customfunctioncallbacktimerqueue.schedule(s, j, new FunctionTagCallback(minecraftkey));
++ source.sendSuccess(() -> {
++ return Component.translatable("commands.schedule.created.tag", Component.translationArg(minecraftkey), time, j);
++ }, true);
++ });
++ return Math.floorMod(j, Integer.MAX_VALUE);
+ }
+ }
+