Start work on predicates, somewhat

This commit is contained in:
Eclipse 2024-11-30 10:34:22 +00:00
parent 4514f55273
commit 8ea3c973f3
No known key found for this signature in database
GPG key ID: 95E6998F82EC938A
2 changed files with 9 additions and 4 deletions

View file

@ -50,6 +50,8 @@ public interface CustomItemDefinition {
/**
* The item model this definition is for. If the model is in the {@code minecraft} namespace, then the definition is required to have a predicate.
*
* <p>If multiple item definitions for a model are registered, then only one can have no predicate.</p>
*/
@NonNull Key model();
@ -63,7 +65,13 @@ public interface CustomItemDefinition {
return bedrockOptions().icon() == null ? bedrockIdentifier().asString().replaceAll(":", ".").replaceAll("/", "_") : bedrockOptions().icon();
}
// TODO predicate
/**
* The predicate that has to match for this item to be used. These predicates are similar to the Java item model predicates.
*
* <p>If multiple predicates match, then the first registered item with a matching predicate is used. If no predicates match, then the item definition without a predicate
* is used, if any.</p>
*/
void predicate();
/**
* The item's Bedrock options. These describe item properties that can't be described in item components, e.g. item texture size and if the item is allowed in the off-hand.

View file

@ -489,9 +489,6 @@ public class ItemRegistryPopulator {
customIdMappings.put(customMapping.integerId(), customMapping.stringId());
}
// Important for later to find the best match and accurately replicate Java behavior
Collections.reverse(customItemDefinitions);
} else {
customItemDefinitions = Collections.emptyList();
}