Skip to content
On this page
通用

Recipes

top.katton.api.datapackcommon/src/main/kotlin/top/katton/api/datapack/Recipes.kt
由 `common/src/main/kotlin/top/katton/api/datapack/Recipes.kt` 中的 Kotlin KDoc 生成。

IngredientSpec

IngredientSpec通用数据类
kotlin
data class IngredientSpec(val id: Identifier, val isTag: Boolean)

IngredientSpec.toJson

IngredientSpec.toJson通用函数
kotlin
fun toJson(): com.google.gson.JsonElement

Returns the JSON representation of this ingredient.

Minecraft 1.21.5+ uses HolderSet<Item> for ingredients, which serializes as:

  • Plain item: "minecraft:diamond" (string primitive)
  • Tag reference: "#minecraft:planks" (string primitive with # prefix)

The OLD format {"item": "..."} and {"tag": "..."} is no longer accepted.