Class SingletonArgumentInfo<T extends com.mojang.brigadier.arguments.ArgumentType<?>>
java.lang.Object
net.darkhax.bookshelf.common.api.commands.args.SingletonArgumentInfo<T>
- Type Parameters:
T- The argument type.
- All Implemented Interfaces:
net.minecraft.commands.synchronization.ArgumentTypeInfo<T,SingletonArgumentInfo.Template<T>>
public final class SingletonArgumentInfo<T extends com.mojang.brigadier.arguments.ArgumentType<?>>
extends Object
implements net.minecraft.commands.synchronization.ArgumentTypeInfo<T,SingletonArgumentInfo.Template<T>>
An argument info type that will always resolve to the same singleton instance. This is beneficial when the values are
already known by the client in advance, or may even be only known by the client.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSingletonArgumentInfo.Template<T extends com.mojang.brigadier.arguments.ArgumentType<?>>A template that holds a cached argument singleton. -
Method Summary
Modifier and TypeMethodDescription@NotNull SingletonArgumentInfo.Template<T> deserializeFromNetwork(@NotNull net.minecraft.network.FriendlyByteBuf buffer) static <T extends com.mojang.brigadier.arguments.ArgumentType<?>>
SingletonArgumentInfo<T> Creates argument info for a given argument instance.voidserializeToJson(@NotNull SingletonArgumentInfo.Template<T> tTemplate, @NotNull com.google.gson.JsonObject jsonObject) voidserializeToNetwork(@NotNull SingletonArgumentInfo.Template<T> tTemplate, @NotNull net.minecraft.network.FriendlyByteBuf friendlyByteBuf) @NotNull SingletonArgumentInfo.Template<T>
-
Method Details
-
of
public static <T extends com.mojang.brigadier.arguments.ArgumentType<?>> SingletonArgumentInfo<T> of(Supplier<T> argSupplier) Creates argument info for a given argument instance.- Type Parameters:
T- The argument type.- Parameters:
argSupplier- A supplier that resolves the singleton instance. This supplier should always return the same instance!- Returns:
- The argument info for the singleton.
-
serializeToNetwork
public void serializeToNetwork(@NotNull @NotNull SingletonArgumentInfo.Template<T> tTemplate, @NotNull @NotNull net.minecraft.network.FriendlyByteBuf friendlyByteBuf) - Specified by:
serializeToNetworkin interfacenet.minecraft.commands.synchronization.ArgumentTypeInfo<T extends com.mojang.brigadier.arguments.ArgumentType<?>,SingletonArgumentInfo.Template<T extends com.mojang.brigadier.arguments.ArgumentType<?>>>
-
deserializeFromNetwork
@NotNull public @NotNull SingletonArgumentInfo.Template<T> deserializeFromNetwork(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buffer) - Specified by:
deserializeFromNetworkin interfacenet.minecraft.commands.synchronization.ArgumentTypeInfo<T extends com.mojang.brigadier.arguments.ArgumentType<?>,SingletonArgumentInfo.Template<T extends com.mojang.brigadier.arguments.ArgumentType<?>>>
-
serializeToJson
public void serializeToJson(@NotNull @NotNull SingletonArgumentInfo.Template<T> tTemplate, @NotNull @NotNull com.google.gson.JsonObject jsonObject) - Specified by:
serializeToJsonin interfacenet.minecraft.commands.synchronization.ArgumentTypeInfo<T extends com.mojang.brigadier.arguments.ArgumentType<?>,SingletonArgumentInfo.Template<T extends com.mojang.brigadier.arguments.ArgumentType<?>>>
-
unpack
- Specified by:
unpackin interfacenet.minecraft.commands.synchronization.ArgumentTypeInfo<T extends com.mojang.brigadier.arguments.ArgumentType<?>,SingletonArgumentInfo.Template<T extends com.mojang.brigadier.arguments.ArgumentType<?>>>
-