diff --git a/assets/mods/basegame/crafting/metal_processing.json b/assets/mods/basegame/crafting/metal_processing.json deleted file mode 100644 index 0e0dcd235..000000000 --- a/assets/mods/basegame/crafting/metal_processing.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - -} \ No newline at end of file diff --git a/assets/mods/basegame/locales/en/items.json b/assets/mods/basegame/locales/en/items.json index 9b354c1bb..ea3c49b3c 100644 --- a/assets/mods/basegame/locales/en/items.json +++ b/assets/mods/basegame/locales/en/items.json @@ -52,6 +52,7 @@ "ITEM_PICK_STEEL": "Steel Pickaxe", "ITEM_PICK_STONE": "Stone Pickaxe", "ITEM_PICK_WOODEN": "Wooden Pickaxe", + "ITEM_ROCK_SALT": "Rock Salt", "ITEM_SEED_BIRCH": "Birch Seeds", "ITEM_SEED_EBONY": "Ebony Nuts", "ITEM_SEED_OAK": "Oak Acorn", diff --git a/assets/mods/basegame/locales/koKR/items.json b/assets/mods/basegame/locales/koKR/items.json index bd9889c9c..3d83a9224 100644 --- a/assets/mods/basegame/locales/koKR/items.json +++ b/assets/mods/basegame/locales/koKR/items.json @@ -52,6 +52,7 @@ "ITEM_PICK_STEEL": "강철 곡괭이", "ITEM_PICK_STONE": "돌 곡괭이", "ITEM_PICK_WOODEN": "나무 곡괭이", + "ITEM_ROCK_SALT": "암염", "ITEM_SEED_BIRCH": "백단 씨앗", "ITEM_SEED_EBONY": "흑단 씨앗", "ITEM_SEED_OAK": "도토리", diff --git a/src/net/torvald/terrarum/gameitems/GameItem.kt b/src/net/torvald/terrarum/gameitems/GameItem.kt index 0d00e016f..4c3b72fed 100644 --- a/src/net/torvald/terrarum/gameitems/GameItem.kt +++ b/src/net/torvald/terrarum/gameitems/GameItem.kt @@ -3,6 +3,7 @@ package net.torvald.terrarum.gameitems import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.g2d.TextureRegion import net.torvald.terrarum.* +import net.torvald.terrarum.App.printdbg import net.torvald.terrarum.ReferencingRanges.PREFIX_ACTORITEM import net.torvald.terrarum.ReferencingRanges.PREFIX_DYNAMICITEM import net.torvald.terrarum.ReferencingRanges.PREFIX_VIRTUALTILE diff --git a/src/net/torvald/terrarum/itemproperties/ItemCodex.kt b/src/net/torvald/terrarum/itemproperties/ItemCodex.kt index fd1dfe3fb..ad1e206ab 100644 --- a/src/net/torvald/terrarum/itemproperties/ItemCodex.kt +++ b/src/net/torvald/terrarum/itemproperties/ItemCodex.kt @@ -96,16 +96,9 @@ class ItemCodex { * Returns the item in the Codex. If the item is static, its clone will be returned (you are free to modify the returned item). * However, if the item is dynamic, the item itself will be returned. * - * The returned object is a clone of the original object. Modifying fields will NOT affect the game. + * The returned object is mutable. Modifying fields WILL affect the game. */ operator fun get(code: ItemID?): GameItem? { - return get0(code)?.clone() - } - - /** - * Same as `get` but the object is mutable. - */ - fun get0(code: ItemID?): GameItem? { if (code == null) return null if (code.startsWith("$PREFIX_DYNAMICITEM:")) @@ -119,7 +112,7 @@ class ItemCodex { } else // generic item return itemCodex[code] // from CSV - } + } fun dynamicToStaticID(dynamicID: ItemID) = dynamicToStaticTable[dynamicID]!! fun fixtureToItemID(fixture: FixtureBase) = fixtureToSpawnerItemID[fixture.javaClass.canonicalName]!! diff --git a/src/net/torvald/terrarum/modulebasegame/EntryPoint.kt b/src/net/torvald/terrarum/modulebasegame/EntryPoint.kt index e959c86a7..51466dd45 100644 --- a/src/net/torvald/terrarum/modulebasegame/EntryPoint.kt +++ b/src/net/torvald/terrarum/modulebasegame/EntryPoint.kt @@ -50,8 +50,8 @@ class EntryPoint : ModuleEntryPoint() { // add smelting recipe for sands BlockCodex.filter { it.hasTag("SAND") }.forEach { (itemID, _) -> - ItemCodex.get0(itemID)!!.tags.add("SMELTABLE") - ItemCodex.get0(itemID)!!.smeltingProduct = "basegame:148" + ItemCodex[itemID]!!.tags.add("SMELTABLE") + ItemCodex[itemID]!!.smeltingProduct = "basegame:148" } println("\n[Basegame.EntryPoint] Welcome back!") diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSmelterBasic.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSmelterBasic.kt index ec3f7750b..2d493eef8 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSmelterBasic.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/FixtureSmelterBasic.kt @@ -249,6 +249,10 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation { if (progress >= CALORIES_PER_ROASTING) { val smeltingProduct = oreItemProp.smeltingProduct!! + + // check if the item even exists + if (ItemCodex[smeltingProduct] == null) throw NullPointerException("No item prop for $smeltingProduct") + if (productItem == null) productItem = InventoryPair(smeltingProduct, 1L) else diff --git a/src/net/torvald/terrarum/modulebasegame/gameitems/OreItemBase.kt b/src/net/torvald/terrarum/modulebasegame/gameitems/OreItemBase.kt index 96070d7af..fe4767e17 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameitems/OreItemBase.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameitems/OreItemBase.kt @@ -155,7 +155,7 @@ class OreLead(originalID: ItemID) : OreItemBase(originalID, true) { class GemQuartz(originalID: ItemID) : OreItemBase(originalID, true) { override var originalName = "ITEM_GEM_QUARTZ" - override var smeltingProduct: ItemID? = "item@basegame:149" + override var smeltingProduct: ItemID? = "basegame:149" override val itemImage: TextureRegion get() = CommonResourcePool.getAsItemSheet("basegame.items").get(13,6) }