Skip to content

Commit 79bf4af

Browse files
Clean up predicates a bit
1 parent c38bf26 commit 79bf4af

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

api/src/main/java/org/geysermc/geyser/api/item/custom/v2/predicate/CustomModelDataProperty.java api/src/main/java/org/geysermc/geyser/api/item/custom/v2/predicate/match/CustomModelDataString.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* @link https://github.com/GeyserMC/Geyser
2424
*/
2525

26-
package org.geysermc.geyser.api.item.custom.v2.predicate;
26+
package org.geysermc.geyser.api.item.custom.v2.predicate.match;
2727

28-
public record CustomModelDataProperty<T>(T data, int index) {
28+
public record CustomModelDataString(String value, int index) {
2929
}

api/src/main/java/org/geysermc/geyser/api/item/custom/v2/predicate/match/MatchPredicateProperty.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@
2626
package org.geysermc.geyser.api.item.custom.v2.predicate.match;
2727

2828
import net.kyori.adventure.key.Key;
29-
import org.geysermc.geyser.api.item.custom.v2.predicate.CustomModelDataProperty;
3029

3130
// TODO can we do more?
3231
public class MatchPredicateProperty<T> {
3332

3433
public static final MatchPredicateProperty<ChargeType> CHARGE_TYPE = create();
3534
public static final MatchPredicateProperty<Key> TRIM_MATERIAL = create();
3635
public static final MatchPredicateProperty<Key> CONTEXT_DIMENSION = create();
37-
public static final MatchPredicateProperty<CustomModelDataProperty<String>> CUSTOM_MODEL_DATA = create();
36+
public static final MatchPredicateProperty<CustomModelDataString> CUSTOM_MODEL_DATA = create();
3837

3938
private MatchPredicateProperty() {}
4039

core/src/main/java/org/geysermc/geyser/registry/mappings/versions/MappingsReader_v2.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
import org.geysermc.geyser.api.item.custom.v2.CustomItemBedrockOptions;
3737
import org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition;
3838
import org.geysermc.geyser.api.item.custom.v2.predicate.ConditionPredicate;
39-
import org.geysermc.geyser.api.item.custom.v2.predicate.CustomModelDataProperty;
39+
import org.geysermc.geyser.api.item.custom.v2.predicate.match.CustomModelDataString;
4040
import org.geysermc.geyser.api.item.custom.v2.predicate.RangeDispatchPredicate;
4141
import org.geysermc.geyser.api.item.custom.v2.predicate.match.ChargeType;
4242
import org.geysermc.geyser.api.item.custom.v2.predicate.MatchPredicate;
@@ -278,7 +278,7 @@ private void readPredicate(CustomItemDefinition.Builder builder, @NonNull JsonNo
278278
if (indexNode != null && indexNode.isIntegralNumber()) {
279279
index = indexNode.asInt();
280280
}
281-
builder.predicate(new MatchPredicate<>(MatchPredicateProperty.CUSTOM_MODEL_DATA, new CustomModelDataProperty<>(value, index)));
281+
builder.predicate(new MatchPredicate<>(MatchPredicateProperty.CUSTOM_MODEL_DATA, new CustomModelDataString(value, index)));
282282
}
283283
default -> throw new InvalidCustomMappingsFileException("Unknown property " + property);
284284
}

0 commit comments

Comments
 (0)