More recipes for plate press, ignore "unknown tag" errors
This commit is contained in:
parent
c016b8850d
commit
5c87d0f8ab
@ -290,8 +290,21 @@ object DataGen {
|
||||
}
|
||||
|
||||
with(recipeProvider) {
|
||||
plate("iron")
|
||||
plate("tritanium")
|
||||
val baselineMetals = arrayOf("iron", "silver", "bronze", "lead", "constantan")
|
||||
val softMetals = arrayOf("gold", "aluminum", "aluminium", "brass", "copper", "electrum")
|
||||
val hardMetals = arrayOf("tritanium", "steel", "tungsten", "uranium")
|
||||
|
||||
for (thing in baselineMetals) {
|
||||
plate(thing)
|
||||
}
|
||||
|
||||
for (thing in softMetals) {
|
||||
plate(thing, workTicks = 140)
|
||||
}
|
||||
|
||||
for (thing in hardMetals) {
|
||||
plate(thing, workTicks = 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import net.minecraft.world.item.crafting.RecipeSerializer
|
||||
import net.minecraft.world.item.crafting.RecipeType
|
||||
import net.minecraft.world.level.Level
|
||||
import net.minecraftforge.registries.ForgeRegistryEntry
|
||||
import org.apache.logging.log4j.LogManager
|
||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters
|
||||
import ru.dbotthepony.mc.otm.Registry
|
||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityPlatePress
|
||||
@ -69,6 +70,8 @@ class PlatePressRecipe(
|
||||
}
|
||||
|
||||
object PlatePressRecipeFactory : ForgeRegistryEntry<RecipeSerializer<*>>(), RecipeSerializer<PlatePressRecipe> {
|
||||
private val LOGGER = LogManager.getLogger()
|
||||
|
||||
init {
|
||||
registryName = Registry.Names.PLATE_PRESS
|
||||
}
|
||||
@ -77,13 +80,25 @@ object PlatePressRecipeFactory : ForgeRegistryEntry<RecipeSerializer<*>>(), Reci
|
||||
val input = try {
|
||||
Ingredient.fromJson(obj["input"] ?: throw IllegalStateException("Recipe $loc has no input field defined"))
|
||||
} catch (err: Throwable) {
|
||||
throw IllegalStateException("Input of $loc is malformed", err)
|
||||
if (err.message?.lowercase()?.contains("unknown item tag") == true) {
|
||||
LOGGER.warn("Ignoring recipe Input of $loc deserialization error")
|
||||
LOGGER.warn(err)
|
||||
Ingredient.of()
|
||||
} else {
|
||||
throw IllegalStateException("Input of $loc is malformed", err)
|
||||
}
|
||||
}
|
||||
|
||||
val result = try {
|
||||
Ingredient.fromJson(obj["result"] ?: throw IllegalStateException("Recipe $loc has no result field defined"))
|
||||
} catch (err: Throwable) {
|
||||
throw IllegalStateException("Result of $loc is malformed", err)
|
||||
if (err.message?.lowercase()?.contains("unknown item tag") == true) {
|
||||
LOGGER.warn("Ignoring recipe Output of $loc deserialization error")
|
||||
LOGGER.warn(err)
|
||||
Ingredient.of()
|
||||
} else {
|
||||
throw IllegalStateException("Result of $loc is malformed", err)
|
||||
}
|
||||
}
|
||||
|
||||
val workTime = (obj["work_time"] as? JsonPrimitive)?.let { return@let try {it.asInt} catch(err: Throwable) {throw IllegalStateException("Invalid work_time")} } ?: 200
|
||||
|
Loading…
Reference in New Issue
Block a user