Skip to content

Commit

Permalink
make recipe tags lowercase + added test
Browse files Browse the repository at this point in the history
  • Loading branch information
12rcu committed Jul 7, 2024
1 parent 4a9aa26 commit 8361150
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,23 @@ class BehRecipe : MonsteraRawFile() {

@SerializedName("key")
@Expose
var key: MutableMap<String, String>? = null
@JsonAdapter(MonsteraMapFileTypeAdapter::class)
var key: MutableMap<String, ItemInfo>? = null
@MonsteraBuildSetter set

@OptIn(MonsteraBuildSetter::class)
fun addKey(key: String, item: String) {
this.key = (this.key ?: mutableMapOf()).apply { put(key, item) }
this.key = (this.key ?: mutableMapOf()).apply { put(key, ItemInfo().apply { this.item = item }) }
}

@OptIn(MonsteraBuildSetter::class)
fun addKey(key: String, item: ItemInfo.() -> Unit) {
this.key = (this.key ?: mutableMapOf()).apply { put(key, ItemInfo().apply(item)) }
}

@SerializedName("unlock")
@Expose
@JsonAdapter(MonsteraListFileTypeAdapter::class)
var unlockData: MutableList<ItemInfo>? = null
@MonsteraBuildSetter set

Expand Down Expand Up @@ -321,14 +328,31 @@ class BehRecipe : MonsteraRawFile() {
}

enum class RecipeTags {
@SerializedName("furnace")
FURNACE,

@SerializedName("blast_furnace")
BLAST_FURNACE,

@SerializedName("smoker")
SMOKER,

@SerializedName("campfire")
CAMPFIRE,

@SerializedName("soul_campfire")
SOUL_CAMPFIRE,

@SerializedName("crafting_table")
CRAFTING_TABLE,

@SerializedName("stonecutter")
STONECUTTER,

@SerializedName("smithing_table")
SMITHING_TABLE,

@SerializedName("brewing_stand")
BREWING_STAND;

override fun toString(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BasicEntityTest {

@Test
fun basicEntityTest() = testAddon {
entity("soldior_test") {
entity("soldier_test") {
resource {
textureLayer(
arrayListOf(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.lop.devtools.monstera.addon.entitiy

import com.lop.devtools.monstera.addon.buildTestAddon
import com.lop.devtools.monstera.addon.testAddon
import kotlin.test.AfterTest
import kotlin.test.Test

class RecipeTest {
@AfterTest
fun buildTask() {
buildTestAddon()
}

@Test
fun basicEntityRecipeTest() = testAddon {
entity("test_recipe") {
behaviour {
components {
physics { }
}
craftingRecipe {
val n = ""
val s = "minecraft:stick"
val d = "minecraft:diamond"

craftingPattern(
t(n, d, n),
t(n, d, n),
t(n, s, n)
)

unlockRequirement {
item = d
}
}
}
}
}
}

0 comments on commit 8361150

Please sign in to comment.