1010
1111import java .util .function .Supplier ;
1212
13- public record GeyserRangeDispatchPredicate (Property property , float threshold , float scale , boolean normalise ) implements GeyserPredicate {
13+ public record GeyserRangeDispatchPredicate (Property property , float threshold , float scale ) implements GeyserPredicate {
1414
1515 public static final MapCodec <GeyserRangeDispatchPredicate > CODEC = RecordCodecBuilder .mapCodec (instance ->
1616 instance .group (
1717 Property .CODEC .forGetter (GeyserRangeDispatchPredicate ::property ),
1818 Codec .FLOAT .fieldOf ("threshold" ).forGetter (GeyserRangeDispatchPredicate ::threshold ),
19- Codec .FLOAT .fieldOf ("scale" ).forGetter (GeyserRangeDispatchPredicate ::scale ),
20- Codec .BOOL .fieldOf ("normalize" ).forGetter (GeyserRangeDispatchPredicate ::normalise )
19+ Codec .FLOAT .fieldOf ("scale" ).forGetter (GeyserRangeDispatchPredicate ::scale )
2120 ).apply (instance , GeyserRangeDispatchPredicate ::new )
2221 );
2322
2423 public static final Property BUNDLE_FULLNESS = unit (Property .Type .BUNDLE_FULLNESS );
25- public static final Property DAMAGE = unit (Property .Type .DAMAGE );
26- public static final Property COUNT = unit (Property .Type .COUNT );
2724
2825 @ Override
2926 public Type type () {
@@ -38,8 +35,8 @@ public interface Property {
3835
3936 enum Type implements StringRepresentable {
4037 BUNDLE_FULLNESS ("bundle_fullness" , () -> MapCodec .unit (GeyserRangeDispatchPredicate .BUNDLE_FULLNESS )),
41- DAMAGE ("damage" , () -> MapCodec . unit ( GeyserRangeDispatchPredicate . DAMAGE ) ),
42- COUNT ("count" , () -> MapCodec . unit ( GeyserRangeDispatchPredicate . COUNT ) ),
38+ DAMAGE ("damage" , () -> Damage . CODEC ),
39+ COUNT ("count" , () -> Count . CODEC ),
4340 CUSTOM_MODEL_DATA ("custom_model_data" , () -> CustomModelData .CODEC );
4441
4542 public static final Codec <Type > CODEC = StringRepresentable .fromEnum (Type ::values );
@@ -63,12 +60,26 @@ public MapCodec<? extends Property> codec() {
6360 }
6461 }
6562
63+ public record Damage (boolean normalize ) implements Property {
64+ public static final MapCodec <Damage > CODEC = Codec .BOOL .fieldOf ("normalize" ).xmap (Damage ::new , Damage ::normalize );
65+
66+ @ Override
67+ public Type type () {
68+ return Type .DAMAGE ;
69+ }
70+ }
71+
72+ public record Count (boolean normalize ) implements Property {
73+ public static final MapCodec <Count > CODEC = Codec .BOOL .fieldOf ("normalize" ).xmap (Count ::new , Count ::normalize );
74+
75+ @ Override
76+ public Type type () {
77+ return Type .COUNT ;
78+ }
79+ }
80+
6681 public record CustomModelData (int index ) implements Property {
67- public static final MapCodec <CustomModelData > CODEC = RecordCodecBuilder .mapCodec (instance ->
68- instance .group (
69- ExtraCodecs .NON_NEGATIVE_INT .optionalFieldOf ("index" , 0 ).forGetter (CustomModelData ::index )
70- ).apply (instance , CustomModelData ::new )
71- );
82+ public static final MapCodec <CustomModelData > CODEC = ExtraCodecs .NON_NEGATIVE_INT .optionalFieldOf ("index" , 0 ).xmap (CustomModelData ::new , CustomModelData ::index );
7283
7384 @ Override
7485 public Type type () {
0 commit comments