From eab2a53ed97be012b0cabfa6363a98c6bb417e21 Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Wed, 23 Mar 2022 19:36:40 +0900 Subject: [PATCH] 22w11a registry (#3046) * 22w11a registry * Map registry stuff * Rename and move classes * Add javadoc --- .../command/CommandRegistryAccess.mapping | 30 +++++++++++++++ .../command/CommandRegistryWrapper.mapping | 37 +++++++++++++++++++ .../util/registry/BuiltinRegistries.mapping | 2 +- .../util/registry/RegistryKey.mapping | 1 + 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 mappings/net/minecraft/command/CommandRegistryAccess.mapping create mode 100644 mappings/net/minecraft/command/CommandRegistryWrapper.mapping diff --git a/mappings/net/minecraft/command/CommandRegistryAccess.mapping b/mappings/net/minecraft/command/CommandRegistryAccess.mapping new file mode 100644 index 0000000000..1d7a5ddf66 --- /dev/null +++ b/mappings/net/minecraft/command/CommandRegistryAccess.mapping @@ -0,0 +1,30 @@ +CLASS net/minecraft/class_7157 net/minecraft/command/CommandRegistryAccess + COMMENT A class that creates {@link CommandRegistryWrapper} with ability to set a policy on + COMMENT how to handle unrecognized tags. + COMMENT + COMMENT @apiNote You usually do not need to create your own instance; the command registration + COMMENT callbacks (such as {@link net.minecraft.server.command.CommandManager} constructor) + COMMENT provides an instance with proper configurations. + FIELD field_37820 dynamicRegistryManager Lnet/minecraft/class_5455; + FIELD field_37821 entryListCreationPolicy Lnet/minecraft/class_7157$class_7158; + METHOD (Lnet/minecraft/class_5455;)V + ARG 1 dynamicRegistryManager + METHOD method_41698 setEntryListCreationPolicy (Lnet/minecraft/class_7157$class_7158;)V + COMMENT Sets the policy on how to handle unrecognized tags. + COMMENT + COMMENT

See {@link CommandRegistryAccess.EntryListCreationPolicy} for the description of + COMMENT each policy. + ARG 1 entryListCreationPolicy + METHOD method_41699 createWrapper (Lnet/minecraft/class_5321;)Lnet/minecraft/class_7225; + COMMENT Creates a registry wrapper that follows the entry list creation policy. + ARG 1 registryRef + COMMENT the registry key of the registry to wrap + CLASS class_7158 EntryListCreationPolicy + COMMENT A policy on how to handle a {@link TagKey} that does not resolve to an existing + COMMENT tag (unrecognized tag) in {@link CommandRegistryWrapper#getEntryList}. + FIELD field_37824 Lnet/minecraft/class_7157$class_7158; + COMMENT Creates a new {@link RegistryEntryList}, stores it and returns it. + FIELD field_37825 Lnet/minecraft/class_7157$class_7158; + COMMENT Returns a new, empty {@link RegistryEntryList} every time. + FIELD field_37826 Lnet/minecraft/class_7157$class_7158; + COMMENT Returns {@link Optional.empty()}. diff --git a/mappings/net/minecraft/command/CommandRegistryWrapper.mapping b/mappings/net/minecraft/command/CommandRegistryWrapper.mapping new file mode 100644 index 0000000000..444773b19e --- /dev/null +++ b/mappings/net/minecraft/command/CommandRegistryWrapper.mapping @@ -0,0 +1,37 @@ +CLASS net/minecraft/class_7225 net/minecraft/command/CommandRegistryWrapper + COMMENT A wrapper of a registry, used in command arguments. + COMMENT + COMMENT

The methods in this class in most cases perform the same as ones defined + COMMENT in {@link Registry}. However, subclasses may have slightly different behaviors + COMMENT to make it easier to handle user-passed arguments. For example, {@link #getEntryList(TagKey)} + COMMENT may return an empty {@link RegistryEntryList} instead of {@link Optional.empty()}. + COMMENT + COMMENT

A wrapper without any special behaviors can be created by calling {#link of(Registry)}. + METHOD method_41700 getEntryList (Lnet/minecraft/class_6862;)Ljava/util/Optional; + COMMENT {@return the entry list for the provided tag} + COMMENT + COMMENT

Implementations have different behaviors for unrecognized tags. The + COMMENT {@linkplain CommandRegistryWrapper.Impl#getEntryList default implementation} + COMMENT returns {@link Optional.empty()}; however, the ones created by + COMMENT {@link CommandRegistryAccess#createWrapper} can create and return a new entry list, or + COMMENT return an empty entry list. + COMMENT + COMMENT @see Registry#getEntryList + COMMENT @see CommandRegistryAccess.EntryListCreationPolicy + ARG 1 tag + METHOD method_42017 streamKeys ()Ljava/util/stream/Stream; + COMMENT {@return a stream of registry keys defined in the wrapped registry} + COMMENT + COMMENT @see Registry#getKeys + METHOD method_42018 of (Lnet/minecraft/class_2378;)Lnet/minecraft/class_7225; + COMMENT {@return a new wrapper for the {@code registry} without any special behaviors} + ARG 0 registry + METHOD method_42019 getEntry (Lnet/minecraft/class_5321;)Ljava/util/Optional; + COMMENT @see Registry#getEntry + ARG 1 key + METHOD method_42020 streamTags ()Ljava/util/stream/Stream; + COMMENT @see Registry#streamTags + CLASS class_7226 Impl + FIELD field_37996 registry Lnet/minecraft/class_2378; + METHOD (Lnet/minecraft/class_2378;)V + ARG 1 registry diff --git a/mappings/net/minecraft/util/registry/BuiltinRegistries.mapping b/mappings/net/minecraft/util/registry/BuiltinRegistries.mapping index d39b334590..1e7b22ee5b 100644 --- a/mappings/net/minecraft/util/registry/BuiltinRegistries.mapping +++ b/mappings/net/minecraft/util/registry/BuiltinRegistries.mapping @@ -55,7 +55,7 @@ CLASS net/minecraft/class_5458 net/minecraft/util/registry/BuiltinRegistries ARG 0 registry ARG 1 key ARG 2 object - METHOD method_40360 (Lnet/minecraft/class_2378;Ljava/lang/String;Ljava/lang/Object;)Lnet/minecraft/class_6880; + METHOD method_40360 addCasted (Lnet/minecraft/class_2378;Ljava/lang/String;Ljava/lang/Object;)Lnet/minecraft/class_6880; ARG 0 registry ARG 1 id ARG 2 value diff --git a/mappings/net/minecraft/util/registry/RegistryKey.mapping b/mappings/net/minecraft/util/registry/RegistryKey.mapping index 9e0d9934e9..015a860fb5 100644 --- a/mappings/net/minecraft/util/registry/RegistryKey.mapping +++ b/mappings/net/minecraft/util/registry/RegistryKey.mapping @@ -57,3 +57,4 @@ CLASS net/minecraft/class_5321 net/minecraft/util/registry/RegistryKey COMMENT @apiNote This can be used to safely cast an unknown key to {@code RegistryKey} COMMENT by passing the registry {@code E}. ARG 1 registryRef + METHOD method_41185 getRegistry ()Lnet/minecraft/class_2960;