@@ -7482,7 +7482,7 @@ index 566304106fd4f1c677a56e7c66282d1570e7b974..f046aca874eb3376696baaad3719a698
74827482 }
74837483
74847484diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java
7485- index 668eb52d71d77f75c24d4840be9a6c49d96dfc34..5c45fe4d6bb9c97868632cf2709efaa04e1a1348 100644
7485+ index 668eb52d71d77f75c24d4840be9a6c49d96dfc34..d4a5ba350f3cf0d6cd2aab786e1ef8dbb616ee2b 100644
74867486--- a/net/minecraft/commands/Commands.java
74877487+++ b/net/minecraft/commands/Commands.java
74887488@@ -196,15 +196,15 @@ public class Commands {
@@ -7535,9 +7535,8 @@ index 668eb52d71d77f75c24d4840be9a6c49d96dfc34..5c45fe4d6bb9c97868632cf2709efaa0
75357535 RecipeCommand.register(this.dispatcher);
75367536 FetchProfileCommand.register(this.dispatcher);
75377537- ReturnCommand.register(this.dispatcher);
7538- - RideCommand.register(this.dispatcher);
75397538+ ReturnCommand.register(this.dispatcher); // Folia - region threading - TODO later
7540- + RideCommand.register(this.dispatcher); // Folia - region threading - TODO later
7539+ RideCommand.register(this.dispatcher);
75417540 RotateCommand.register(this.dispatcher);
75427541 SayCommand.register(this.dispatcher);
75437542- ScheduleCommand.register(this.dispatcher);
@@ -9807,6 +9806,74 @@ index ce7956b706ecfa036e03c1f6207efac4b84f4afd..2df9ef239c723a7d6a9574ebdd919e0b
98079806 }
98089807
98099808 if (i == 0) {
9809+ diff --git a/net/minecraft/server/commands/RideCommand.java b/net/minecraft/server/commands/RideCommand.java
9810+ index 552b15ac8a35ced2cb48e48ab972d995f5286518..2ecd61d7b90c2f8f5d81ab6ba6264b535afea455 100644
9811+ --- a/net/minecraft/server/commands/RideCommand.java
9812+ +++ b/net/minecraft/server/commands/RideCommand.java
9813+ @@ -56,7 +56,22 @@ public class RideCommand {
9814+ );
9815+ }
9816+
9817+ - private static int mount(CommandSourceStack source, Entity target, Entity vehicle) throws CommandSyntaxException {
9818+ + // Folia start - region threading
9819+ + private static void sendMessage(CommandSourceStack src, CommandSyntaxException ex) {
9820+ + src.sendFailure((Component)ex.getRawMessage());
9821+ + }
9822+ + // Folia end - region threading
9823+ +
9824+ + private static int mount(CommandSourceStack source, Entity targetOld, Entity vehicleOld) throws CommandSyntaxException { // Folia - region threading
9825+ + // Folia start - region threading
9826+ + targetOld.getBukkitEntity().taskScheduler.schedule((Entity target) -> {
9827+ + try {
9828+ + Entity vehicle = vehicleOld.getBukkitEntity().getHandleRaw();
9829+ + if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(vehicle)) {
9830+ + source.sendFailure(Component.literal("Cannot mount entities cross-region"));
9831+ + return;
9832+ + }
9833+ + // Folia end - region threading
9834+ Entity vehicle1 = target.getVehicle();
9835+ if (vehicle1 != null) {
9836+ throw ERROR_ALREADY_RIDING.create(target.getDisplayName(), vehicle1.getDisplayName());
9837+ @@ -70,18 +85,36 @@ public class RideCommand {
9838+ throw ERROR_MOUNT_FAILED.create(target.getDisplayName(), vehicle.getDisplayName());
9839+ } else {
9840+ source.sendSuccess(() -> Component.translatable("commands.ride.mount.success", target.getDisplayName(), vehicle.getDisplayName()), true);
9841+ - return 1;
9842+ + return; // Folia - region threading
9843+ }
9844+ + // Folia start - region threading
9845+ + } catch (CommandSyntaxException ex) {
9846+ + sendMessage(source, ex);
9847+ + }
9848+ + }, null, 1L);
9849+ + return 0;
9850+ + // Folia end - region threading
9851+ }
9852+
9853+ - private static int dismount(CommandSourceStack source, Entity target) throws CommandSyntaxException {
9854+ + private static int dismount(CommandSourceStack source, Entity targetOld) throws CommandSyntaxException { // Folia - region threading
9855+ + // Folia start - region threading
9856+ + targetOld.getBukkitEntity().taskScheduler.schedule((Entity target) -> {
9857+ + try {
9858+ + // Folia end - region threading
9859+ Entity vehicle = target.getVehicle();
9860+ if (vehicle == null) {
9861+ throw ERROR_NOT_RIDING.create(target.getDisplayName());
9862+ } else {
9863+ target.stopRiding();
9864+ source.sendSuccess(() -> Component.translatable("commands.ride.dismount.success", target.getDisplayName(), vehicle.getDisplayName()), true);
9865+ - return 1;
9866+ + return; // Folia - region threading
9867+ }
9868+ + // Folia start - region threading
9869+ + } catch (CommandSyntaxException ex) {
9870+ + sendMessage(source, ex);
9871+ + }
9872+ + }, null, 1L);
9873+ + return 0;
9874+ + // Folia end - region threading
9875+ }
9876+ }
98109877diff --git a/net/minecraft/server/commands/RotateCommand.java b/net/minecraft/server/commands/RotateCommand.java
98119878index 3f3d55a7ba65c9e83ba140d585f49317f6b56cb1..b090cf8d4b7d1e60fe37866740b015c25bff1e29 100644
98129879--- a/net/minecraft/server/commands/RotateCommand.java
0 commit comments