Skip to content

[1.7.10] Registry suggestion crash #49

@JackOfNoneTrades

Description

@JackOfNoneTrades

At this line, there is a FMLControlledNamespacedRegistry to Collection cast which fails.
The following in a mixin @Overwrite fixes the issue:

public void provideSuggestions(Consumer<ISuggestionProvider.Suggestion> output, Predicate<ISuggestionProvider.Suggestion> filter) {
        for(Object entry : ((RegistryValueAccessor)value).getRegistry().typeSafeIterable()) {
            String key = ((RegistryValueAccessor)value).getRegistry().getNameForObject(entry).toString();
            ISuggestionProvider.Suggestion suggestion = ISuggestionProvider.Suggestion.namedTypeValue(key, key, ((RegistryValueAccessor) value).getClz());
            if(filter.test(suggestion)) output.accept(suggestion);
        }
    }

This happens when I add an item config entry and when I try to add a second item to the array, from the GUI.

RegistryValue<Item> itemCE = RegistryValue
            .builder("testItem", Item.class)
            .addDefault(Items.apple)
            .withFilter(x -> true)
            .withComment("custom item")
            .build(GameData.getItemRegistry());
        generalSection.add(itemCE);

Is there any way to add a RegistryValue that is not an array? For when I want to add a single item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions