diff --git a/common/src/main/kotlin/juuxel/adorn/criterion/BoughtFromTradingStationCriterion.kt b/common/src/main/kotlin/juuxel/adorn/criterion/BoughtFromTradingStationCriterion.kt index fd22ee8f9..258a603b9 100644 --- a/common/src/main/kotlin/juuxel/adorn/criterion/BoughtFromTradingStationCriterion.kt +++ b/common/src/main/kotlin/juuxel/adorn/criterion/BoughtFromTradingStationCriterion.kt @@ -1,7 +1,7 @@ package juuxel.adorn.criterion +import com.google.gson.JsonNull import com.google.gson.JsonObject -import com.google.gson.JsonParseException import net.minecraft.advancement.criterion.AbstractCriterion import net.minecraft.advancement.criterion.AbstractCriterionConditions import net.minecraft.item.ItemStack @@ -18,23 +18,21 @@ class BoughtFromTradingStationCriterion : AbstractCriterion, private val soldItem: ItemPredicate) : + class Conditions(playerPredicate: Optional, private val soldItem: ItemPredicate?) : AbstractCriterionConditions(playerPredicate) { fun matches(stack: ItemStack): Boolean = - soldItem.test(stack) + soldItem == null || soldItem.test(stack) override fun toJson(): JsonObject { val json = super.toJson() - json.add("sold_item", soldItem.toJson()) + json.add("sold_item", soldItem?.toJson() ?: JsonNull.INSTANCE) return json } }