Fixed seapony race appearing in the selection screen

This commit is contained in:
Sollace 2024-04-09 12:34:30 +01:00
parent ca935ce224
commit 4a94c63e9b
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
2 changed files with 3 additions and 3 deletions

View file

@ -98,7 +98,7 @@ public record Race (
public static final Race HIPPOGRIFF = register("hippogriff", new Builder().foraging().flight(FlightType.AVIAN).cloudMagic()
.abilities(Abilities.TOGGLE_FLIGHT, Abilities.SCREECH, Abilities.PECK, Abilities.DASH, Abilities.CARRY)
);
public static final Race SEAPONY = register("seapony", new Builder().foraging().fish()
public static final Race SEAPONY = register("seapony", new Builder().availability(Availability.COMMANDS).foraging().fish()
.abilities(Abilities.SONAR_PULSE)
);
@ -229,7 +229,7 @@ public record Race (
Identifier id = context.getArgument(name, RegistryKey.class).getValue();
final Identifier idf = id;
if (id.getNamespace() == Identifier.DEFAULT_NAMESPACE && !REGISTRY.containsId(id)) {
id = Unicopia.id(id.getPath());
id = new Identifier(REGISTRY_KEY.getValue().getNamespace(), id.getPath());
}
return REGISTRY.getOrEmpty(id).orElseThrow(() -> UNKNOWN_RACE_EXCEPTION.create(idf));
}

View file

@ -21,7 +21,7 @@ import net.minecraft.util.Identifier;
public class UCommandSuggestion {
public static final SuggestionProvider<ServerCommandSource> ALL_RACE_SUGGESTIONS = suggestFromRegistry(Race.REGISTRY_KEY);
public static final SuggestionProvider<ServerCommandSource> ALLOWED_RACE_SUGGESTIONS = suggestFromRegistry(Race.REGISTRY_KEY, (context, race) -> race.isPermitted(context.getSource().getPlayer()));
public static final SuggestionProvider<ServerCommandSource> ALLOWED_RACE_SUGGESTIONS = suggestFromRegistry(Race.REGISTRY_KEY, (context, race) -> race.availability().isGrantable() && race.isPermitted(context.getSource().getPlayer()));
public static <T> SuggestionProvider<ServerCommandSource> suggestFromRegistry(RegistryKey<? extends Registry<T>> registryKey, @Nullable BiPredicate<CommandContext<ServerCommandSource>, T> filter) {
return (context, builder) -> {