diff options
Diffstat (limited to 'patches/api/0468-Brigadier-based-command-API.patch')
-rw-r--r-- | patches/api/0468-Brigadier-based-command-API.patch | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/patches/api/0468-Brigadier-based-command-API.patch b/patches/api/0468-Brigadier-based-command-API.patch index bd6921f6cc..7598f0c8b0 100644 --- a/patches/api/0468-Brigadier-based-command-API.patch +++ b/patches/api/0468-Brigadier-based-command-API.patch @@ -964,10 +964,10 @@ index 0000000000000000000000000000000000000000..2db12952461c92a64505d6646f6f49f8 +} diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java b/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java new file mode 100644 -index 0000000000000000000000000000000000000000..1d5c599d1b9c8bf07720e651bdbe9dadb1335b45 +index 0000000000000000000000000000000000000000..f102176791e57d23a148ba79bfc949f4ef470c70 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/brigadier/argument/ArgumentTypes.java -@@ -0,0 +1,349 @@ +@@ -0,0 +1,370 @@ +package io.papermc.paper.command.brigadier.argument; + +import com.mojang.brigadier.arguments.ArgumentType; @@ -975,6 +975,7 @@ index 0000000000000000000000000000000000000000..1d5c599d1b9c8bf07720e651bdbe9dad +import io.papermc.paper.command.brigadier.argument.range.DoubleRangeProvider; +import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider; +import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver; ++import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver; +import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver; +import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver; +import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver; @@ -1056,7 +1057,7 @@ index 0000000000000000000000000000000000000000..1d5c599d1b9c8bf07720e651bdbe9dad + * A selector argument that provides a list + * of player profiles. + * -+ * @return player profile arguments ++ * @return player profile argument + */ + public static @NotNull ArgumentType<PlayerProfileListResolver> playerProfiles() { + return provider().playerProfiles(); @@ -1065,13 +1066,33 @@ index 0000000000000000000000000000000000000000..1d5c599d1b9c8bf07720e651bdbe9dad + /** + * A block position argument. + * -+ * @return argument ++ * @return block position argument + */ + public static @NotNull ArgumentType<BlockPositionResolver> blockPosition() { + return provider().blockPosition(); + } + + /** ++ * A fine position argument. ++ * ++ * @return fine position argument ++ * @see #finePosition(boolean) to center whole numbers ++ */ ++ public static @NotNull ArgumentType<FinePositionResolver> finePosition() { ++ return finePosition(false); ++ } ++ ++ /** ++ * A fine position argument. ++ * ++ * @param centerIntegers if whole numbers should be centered (+0.5) ++ * @return fine position argument ++ */ ++ public static @NotNull ArgumentType<FinePositionResolver> finePosition(final boolean centerIntegers) { ++ return provider().finePosition(centerIntegers); ++ } ++ ++ /** + * A blockstate argument which will provide rich parsing for specifying + * the specific block variant and then the block entity NBT if applicable. + * @@ -1519,10 +1540,10 @@ index 0000000000000000000000000000000000000000..159b691e7a1a7066f3e706e80d75ca8f +} diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProvider.java b/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProvider.java new file mode 100644 -index 0000000000000000000000000000000000000000..fbbbf324c002dddd868ba2fb56ddda92149ced3c +index 0000000000000000000000000000000000000000..e8c1c0f781bfc852af4a0f01452566ae994dc285 --- /dev/null +++ b/src/main/java/io/papermc/paper/command/brigadier/argument/VanillaArgumentProvider.java -@@ -0,0 +1,104 @@ +@@ -0,0 +1,107 @@ +package io.papermc.paper.command.brigadier.argument; + +import com.mojang.brigadier.arguments.ArgumentType; @@ -1530,6 +1551,7 @@ index 0000000000000000000000000000000000000000..fbbbf324c002dddd868ba2fb56ddda92 +import io.papermc.paper.command.brigadier.argument.range.DoubleRangeProvider; +import io.papermc.paper.command.brigadier.argument.range.IntegerRangeProvider; +import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver; ++import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver; +import io.papermc.paper.command.brigadier.argument.resolvers.PlayerProfileListResolver; +import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver; +import io.papermc.paper.command.brigadier.argument.resolvers.selector.PlayerSelectorArgumentResolver; @@ -1580,6 +1602,8 @@ index 0000000000000000000000000000000000000000..fbbbf324c002dddd868ba2fb56ddda92 + + ArgumentType<BlockPositionResolver> blockPosition(); + ++ ArgumentType<FinePositionResolver> finePosition(boolean centerIntegers); ++ + ArgumentType<BlockState> blockState(); + + ArgumentType<ItemStack> itemStack(); @@ -1770,6 +1794,29 @@ index 0000000000000000000000000000000000000000..908f40dbf3e52bdfc8577a8916884e9f +public interface BlockPositionResolver extends ArgumentResolver<BlockPosition> { +} +diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/FinePositionResolver.java b/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/FinePositionResolver.java +new file mode 100644 +index 0000000000000000000000000000000000000000..e2fc26016b8d68fd0d69c8ca962f61fe65471b24 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/FinePositionResolver.java +@@ -0,0 +1,17 @@ ++package io.papermc.paper.command.brigadier.argument.resolvers; ++ ++import io.papermc.paper.command.brigadier.CommandSourceStack; ++import io.papermc.paper.math.FinePosition; ++import org.jetbrains.annotations.ApiStatus; ++ ++/** ++ * An {@link ArgumentResolver} that's capable of resolving ++ * a fine position argument value using a {@link CommandSourceStack}. ++ * ++ * @see io.papermc.paper.command.brigadier.argument.ArgumentTypes#finePosition() ++ * @see io.papermc.paper.command.brigadier.argument.ArgumentTypes#finePosition(boolean) ++ */ ++public interface FinePositionResolver extends ArgumentResolver<FinePosition> { ++} diff --git a/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/PlayerProfileListResolver.java b/src/main/java/io/papermc/paper/command/brigadier/argument/resolvers/PlayerProfileListResolver.java new file mode 100644 index 0000000000000000000000000000000000000000..89024e67fd81a9cd8a9d1ef5bb78d1c8bcb4fcc5 |