mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-01-09 11:44:04 +01:00
Clean up predicates a bit
This commit is contained in:
parent
c38bf26298
commit
79bf4afb87
3 changed files with 5 additions and 6 deletions
|
@ -23,7 +23,7 @@
|
|||
* @link https://github.com/GeyserMC/Geyser
|
||||
*/
|
||||
|
||||
package org.geysermc.geyser.api.item.custom.v2.predicate;
|
||||
package org.geysermc.geyser.api.item.custom.v2.predicate.match;
|
||||
|
||||
public record CustomModelDataProperty<T>(T data, int index) {
|
||||
public record CustomModelDataString(String value, int index) {
|
||||
}
|
|
@ -26,7 +26,6 @@
|
|||
package org.geysermc.geyser.api.item.custom.v2.predicate.match;
|
||||
|
||||
import net.kyori.adventure.key.Key;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.CustomModelDataProperty;
|
||||
|
||||
// TODO can we do more?
|
||||
public class MatchPredicateProperty<T> {
|
||||
|
@ -34,7 +33,7 @@ public class MatchPredicateProperty<T> {
|
|||
public static final MatchPredicateProperty<ChargeType> CHARGE_TYPE = create();
|
||||
public static final MatchPredicateProperty<Key> TRIM_MATERIAL = create();
|
||||
public static final MatchPredicateProperty<Key> CONTEXT_DIMENSION = create();
|
||||
public static final MatchPredicateProperty<CustomModelDataProperty<String>> CUSTOM_MODEL_DATA = create();
|
||||
public static final MatchPredicateProperty<CustomModelDataString> CUSTOM_MODEL_DATA = create();
|
||||
|
||||
private MatchPredicateProperty() {}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.geysermc.geyser.api.item.custom.v2.BedrockCreativeTab;
|
|||
import org.geysermc.geyser.api.item.custom.v2.CustomItemBedrockOptions;
|
||||
import org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.ConditionPredicate;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.CustomModelDataProperty;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.match.CustomModelDataString;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.RangeDispatchPredicate;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.match.ChargeType;
|
||||
import org.geysermc.geyser.api.item.custom.v2.predicate.MatchPredicate;
|
||||
|
@ -278,7 +278,7 @@ public class MappingsReader_v2 extends MappingsReader {
|
|||
if (indexNode != null && indexNode.isIntegralNumber()) {
|
||||
index = indexNode.asInt();
|
||||
}
|
||||
builder.predicate(new MatchPredicate<>(MatchPredicateProperty.CUSTOM_MODEL_DATA, new CustomModelDataProperty<>(value, index)));
|
||||
builder.predicate(new MatchPredicate<>(MatchPredicateProperty.CUSTOM_MODEL_DATA, new CustomModelDataString(value, index)));
|
||||
}
|
||||
default -> throw new InvalidCustomMappingsFileException("Unknown property " + property);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue