mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
[1.18] Fix tags command suggestion to include dynamic registries (#8638)
Manually entering the names of dynamic registries work as expected. The suggestions for registries didn't include dynamic registries because they queried the static registries rather than querying all registries from the server's `RegistryAccess` (which includes both static registries and dynamic registries).
This commit is contained in:
1 parent
1353c1d9fa
commit
8a1c1d7e53
1 file changed
+6
-2
@@ -24,6 +24,7 @@ import net.minecraft.commands.arguments.ResourceLocationArgument;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.chat.ClickEvent;
|
||||
import net.minecraft.network.chat.ComponentUtils;
|
||||
import net.minecraft.network.chat.HoverEvent;
|
||||
@@ -232,8 +233,11 @@ class TagsCommand
|
||||
private static CompletableFuture<Suggestions> suggestRegistries(final CommandContext<CommandSourceStack> ctx,
|
||||
final SuggestionsBuilder builder)
|
||||
{
|
||||
ctx.getSource().suggestRegistryElements(Registry.REGISTRY,
|
||||
SharedSuggestionProvider.ElementSuggestionType.ELEMENTS, builder);
|
||||
ctx.getSource().registryAccess().registries()
|
||||
.map(RegistryAccess.RegistryEntry::key)
|
||||
.map(ResourceKey::location)
|
||||
.map(ResourceLocation::toString)
|
||||
.forEach(builder::suggest);
|
||||
return builder.buildFuture();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user