idea refactor moment
This commit is contained in:
parent
a956d9a34f
commit
167ea42ec8
@ -27,7 +27,7 @@ class HurtTrigger(id: ResourceLocation) : MCriterionTrigger<HurtTrigger.Instance
|
||||
ContextAwarePredicate.CODEC.optionalFieldOf("predicate").forGetter(Instance::predicate),
|
||||
DamagePredicateCodec.optionalFieldOf("damagePredicate").forGetter(Instance::damagePredicate),
|
||||
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate)
|
||||
).apply(it, HurtTrigger::Instance)
|
||||
).apply(it, ::Instance)
|
||||
}
|
||||
|
||||
inner class Instance(
|
||||
|
@ -19,7 +19,7 @@ class ItemTrigger(id: ResourceLocation) : MCriterionTrigger<ItemTrigger.Instance
|
||||
ItemPredicate.CODEC.fieldOf("predicate").forGetter(Instance::predicate),
|
||||
Codec.BOOL.optionalFieldOf("invert", false).forGetter(Instance::invert),
|
||||
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)
|
||||
|
@ -11,7 +11,7 @@ class SingletonTrigger(id: ResourceLocation) : MCriterionTrigger<SingletonTrigge
|
||||
override val codec: Codec<Instance> = RecordCodecBuilder.create {
|
||||
it.group(
|
||||
ContextAwarePredicate.CODEC.optionalFieldOf("player").forGetter(Instance::playerPredicate)
|
||||
).apply(it, SingletonTrigger::Instance)
|
||||
).apply(it, ::Instance)
|
||||
}
|
||||
|
||||
val empty = Instance()
|
||||
|
Loading…
Reference in New Issue
Block a user