idea refactor moment

This commit is contained in:
DBotThePony 2025-03-31 20:56:33 +07:00
parent a956d9a34f
commit 167ea42ec8
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ class HurtTrigger(id: ResourceLocation) : MCriterionTrigger<HurtTrigger.Instance
ContextAwarePredicate.CODEC.optionalFieldOf("predicate").forGetter(Instance::predicate), ContextAwarePredicate.CODEC.optionalFieldOf("predicate").forGetter(Instance::predicate),
DamagePredicateCodec.optionalFieldOf("damagePredicate").forGetter(Instance::damagePredicate), DamagePredicateCodec.optionalFieldOf("damagePredicate").forGetter(Instance::damagePredicate),
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate) ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate)
).apply(it, HurtTrigger::Instance) ).apply(it, ::Instance)
} }
inner class Instance( inner class Instance(

View File

@ -19,7 +19,7 @@ class ItemTrigger(id: ResourceLocation) : MCriterionTrigger<ItemTrigger.Instance
ItemPredicate.CODEC.fieldOf("predicate").forGetter(Instance::predicate), ItemPredicate.CODEC.fieldOf("predicate").forGetter(Instance::predicate),
Codec.BOOL.optionalFieldOf("invert", false).forGetter(Instance::invert), Codec.BOOL.optionalFieldOf("invert", false).forGetter(Instance::invert),
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate) ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate)
).apply(it, ItemTrigger::Instance) ).apply(it, ::Instance)
} }
inner class Instance(val predicate: ItemPredicate, val invert: Boolean = false, player: Optional<ContextAwarePredicate> = Optional.empty()) : AbstractInstance(player) inner class Instance(val predicate: ItemPredicate, val invert: Boolean = false, player: Optional<ContextAwarePredicate> = Optional.empty()) : AbstractInstance(player)

View File

@ -11,7 +11,7 @@ class SingletonTrigger(id: ResourceLocation) : MCriterionTrigger<SingletonTrigge
override val codec: Codec<Instance> = RecordCodecBuilder.create { override val codec: Codec<Instance> = RecordCodecBuilder.create {
it.group( it.group(
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate) ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate)
).apply(it, SingletonTrigger::Instance) ).apply(it, ::Instance)
} }
val empty = Instance() val empty = Instance()