fix smelting/blasting recipe locations and move direct ResourceLocation calls to modLocation for datagen

This commit is contained in:
YuRaNnNzZZ 2023-05-08 16:20:41 +03:00
parent f71bed5dae
commit 8d96615ddd
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
13 changed files with 88 additions and 105 deletions

View File

@ -1,6 +1,5 @@
package ru.dbotthepony.mc.otm.datagen package ru.dbotthepony.mc.otm.datagen
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.AnvilBlock import net.minecraft.world.level.block.AnvilBlock
import net.minecraft.world.level.block.SlabBlock import net.minecraft.world.level.block.SlabBlock
import net.minecraft.world.level.block.StairBlock import net.minecraft.world.level.block.StairBlock
@ -9,7 +8,6 @@ import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraftforge.client.model.generators.BlockModelBuilder import net.minecraftforge.client.model.generators.BlockModelBuilder
import net.minecraftforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
import net.minecraftforge.client.model.generators.ModelFile import net.minecraftforge.client.model.generators.ModelFile
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
@ -200,13 +198,13 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
var labLampOff: BlockModelBuilder? = null var labLampOff: BlockModelBuilder? = null
blockModelProvider.exec { blockModelProvider.exec {
val top = ResourceLocation(DataGen.MOD_ID, "block/decorative/metal_beam_top") val top = modLocation("block/decorative/metal_beam_top")
labLampOn = it.cube( labLampOn = it.cube(
MBlocks.LABORATORY_LAMP.registryName!!.path, MBlocks.LABORATORY_LAMP.registryName!!.path,
top, top,
top, top,
ResourceLocation(DataGen.MOD_ID, "block/decorative/laboratory_lamp_front"), modLocation("block/decorative/laboratory_lamp_front"),
top, top,
top, top,
top, top,
@ -216,7 +214,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
MBlocks.LABORATORY_LAMP.registryName!!.path + "_unlit", MBlocks.LABORATORY_LAMP.registryName!!.path + "_unlit",
top, top,
top, top,
ResourceLocation(DataGen.MOD_ID, "block/decorative/laboratory_lamp_front_off"), modLocation("block/decorative/laboratory_lamp_front_off"),
top, top,
top, top,
top, top,
@ -248,11 +246,11 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
blockModelProvider.exec { blockModelProvider.exec {
for (crate in MRegistry.CARGO_CRATES.blocks.values) { for (crate in MRegistry.CARGO_CRATES.blocks.values) {
it.withExistingParent("${crate.registryName!!.path}_closed", ResourceLocation(OverdriveThatMatters.MOD_ID, "${MNames.CARGO_CRATE}_closed")) it.withExistingParent("${crate.registryName!!.path}_closed", modLocation("${MNames.CARGO_CRATE}_closed"))
.texture("texture", "block/cargo_crates/${crate.registryName!!.path}") .texture("texture", "block/cargo_crates/${crate.registryName!!.path}")
.texture("particle", "block/cargo_crates/${crate.registryName!!.path}") .texture("particle", "block/cargo_crates/${crate.registryName!!.path}")
it.withExistingParent("${crate.registryName!!.path}_open", ResourceLocation(OverdriveThatMatters.MOD_ID, "${MNames.CARGO_CRATE}_open")) it.withExistingParent("${crate.registryName!!.path}_open", modLocation("${MNames.CARGO_CRATE}_open"))
.texture("texture", "block/cargo_crates/${crate.registryName!!.path}") .texture("texture", "block/cargo_crates/${crate.registryName!!.path}")
.texture("particle", "block/cargo_crates/${crate.registryName!!.path}") .texture("particle", "block/cargo_crates/${crate.registryName!!.path}")
} }
@ -273,12 +271,12 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks) { for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks) {
val name = MRegistry.INDUSTRIAL_GLASS.allBlocks[color]!!.registryName!!.path val name = MRegistry.INDUSTRIAL_GLASS.allBlocks[color]!!.registryName!!.path
val textureSide = ResourceLocation(DataGen.MOD_ID, "block/decorative/$name") val textureSide = modLocation("block/decorative/$name")
val textureRailing = ResourceLocation(DataGen.MOD_ID, "block/decorative/industrial_glass_frame") val textureRailing = modLocation("block/decorative/industrial_glass_frame")
DataGen.pane(glass, textureSide, textureRailing) DataGen.pane(glass, textureSide, textureRailing)
} }
DataGen.bars(MBlocks.TRITANIUM_BARS, ResourceLocation(DataGen.MOD_ID, "block/decorative/tritanium_bars")) DataGen.bars(MBlocks.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars"))
blockStateProvider.block(MBlocks.ENGINE) blockStateProvider.block(MBlocks.ENGINE)
itemModelProvider.block(MItems.ENGINE) itemModelProvider.block(MItems.ENGINE)

View File

@ -1,6 +1,5 @@
package ru.dbotthepony.mc.otm.datagen.blocks package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraftforge.client.model.generators.BlockStateProvider import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
@ -9,6 +8,7 @@ import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
private fun nothingOrNumber(input: Int): String { private fun nothingOrNumber(input: Int): String {
@ -27,7 +27,7 @@ open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(even
with(getVariantBuilder(registry)) { with(getVariantBuilder(registry)) {
forAllStates { forAllStates {
ConfiguredModel.builder() ConfiguredModel.builder()
.modelFile(models().getExistingFile(ResourceLocation("overdrive_that_matters:block/$block"))) .modelFile(models().getExistingFile(modLocation("block/$block")))
.rotationY(it[BlockRotationFreedom.ONE.property].front.yRotationBlockstateNorth()) .rotationY(it[BlockRotationFreedom.ONE.property].front.yRotationBlockstateNorth())
.build() .build()
} }

View File

@ -1,10 +1,8 @@
package ru.dbotthepony.mc.otm.datagen.blocks package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraftforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.block.CableBlock import ru.dbotthepony.mc.otm.block.CableBlock
import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock
import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.entity.WorkerState
@ -50,7 +48,7 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) { with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) {
for (dir in BlockRotationFreedom.ONE.possibleValues) { for (dir in BlockRotationFreedom.ONE.possibleValues) {
for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) { for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "matter_bottler_${enum.name.lowercase()}"))) part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.ONE.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
@ -61,14 +59,14 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
for (dir in BlockRotationFreedom.ONE.possibleValues) { for (dir in BlockRotationFreedom.ONE.possibleValues) {
for (enum in MatterBottlerBlock.SLOT_PROPERTIES) { for (enum in MatterBottlerBlock.SLOT_PROPERTIES) {
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "matter_bottler_${enum.name}_open"))) part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_open")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.ONE.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
.condition(enum, false) .condition(enum, false)
.end() .end()
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "matter_bottler_${enum.name}_closed"))) part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_closed")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.ONE.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
@ -98,8 +96,7 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
return@forAllStates arrayOf( return@forAllStates arrayOf(
ConfiguredModel.builder() ConfiguredModel.builder()
.modelFile(provider.models().getExistingFile( .modelFile(provider.models().getExistingFile(
ResourceLocation( modLocation("${crate.registryName!!.path}_${if (it.getValue(
OverdriveThatMatters.MOD_ID, "${crate.registryName!!.path}_${if (it.getValue(
CargoCrateBlock.IS_OPEN)) "open" else "closed"}") CargoCrateBlock.IS_OPEN)) "open" else "closed"}")
)) ))
.rotationY(it.getValue(BlockRotationFreedom.ONE.property).front.yRotationBlockstateNorth()) .rotationY(it.getValue(BlockRotationFreedom.ONE.property).front.yRotationBlockstateNorth())
@ -110,14 +107,14 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
with(provider.getMultipartBuilder(MBlocks.STORAGE_BUS)) { with(provider.getMultipartBuilder(MBlocks.STORAGE_BUS)) {
for (dir in BlockRotationFreedom.TWO.possibleValues) { for (dir in BlockRotationFreedom.TWO.possibleValues) {
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_bus"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_bus")))
.rotationX(dir.front.xRotationBlockstateNorth()) .rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.TWO.property, dir) .condition(BlockRotationFreedom.TWO.property, dir)
.end() .end()
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_connection"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
.rotationX(dir.front.xRotationBlockstateSouth()) .rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth()) .rotationY(dir.front.yRotationBlockstateSouth())
.addModel() .addModel()
@ -125,20 +122,20 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
.end() .end()
} }
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_core"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core")))
.addModel().end() .addModel().end()
} }
with(provider.getMultipartBuilder(MBlocks.STORAGE_IMPORTER)) { with(provider.getMultipartBuilder(MBlocks.STORAGE_IMPORTER)) {
for (dir in BlockRotationFreedom.TWO.possibleValues) { for (dir in BlockRotationFreedom.TWO.possibleValues) {
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_importer"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_importer")))
.rotationX(dir.front.xRotationBlockstateNorth()) .rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.TWO.property, dir) .condition(BlockRotationFreedom.TWO.property, dir)
.end() .end()
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_connection"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
.rotationX(dir.front.xRotationBlockstateSouth()) .rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth()) .rotationY(dir.front.yRotationBlockstateSouth())
.addModel() .addModel()
@ -146,20 +143,20 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
.end() .end()
} }
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_core"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core")))
.addModel().end() .addModel().end()
} }
with(provider.getMultipartBuilder(MBlocks.STORAGE_EXPORTER)) { with(provider.getMultipartBuilder(MBlocks.STORAGE_EXPORTER)) {
for (dir in BlockRotationFreedom.TWO.possibleValues) { for (dir in BlockRotationFreedom.TWO.possibleValues) {
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_exporter"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_exporter")))
.rotationX(dir.front.xRotationBlockstateNorth()) .rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.TWO.property, dir) .condition(BlockRotationFreedom.TWO.property, dir)
.end() .end()
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_connection"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
.rotationX(dir.front.xRotationBlockstateSouth()) .rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth()) .rotationY(dir.front.yRotationBlockstateSouth())
.addModel() .addModel()
@ -167,7 +164,7 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
.end() .end()
} }
part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_core"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core")))
.addModel().end() .addModel().end()
} }
} }

View File

@ -1,21 +1,20 @@
package ru.dbotthepony.mc.otm.datagen.blocks package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.core.Direction import net.minecraft.core.Direction
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.block.tech.EnergyCounterBlock import ru.dbotthepony.mc.otm.block.tech.EnergyCounterBlock
import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.block.matter.PatternStorageBlock import ru.dbotthepony.mc.otm.block.matter.PatternStorageBlock
import ru.dbotthepony.mc.otm.block.storage.DriveViewerBlock import ru.dbotthepony.mc.otm.block.storage.DriveViewerBlock
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen.MOD_ID import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
fun addComplexBlockStates(provider: MatteryBlockStateProvider) { fun addComplexBlockStates(provider: MatteryBlockStateProvider) {
with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) { with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) {
for (facing in BlockRotationFreedom.ONE.possibleValues) { for (facing in BlockRotationFreedom.ONE.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_drive_part"))) .modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_drive_part")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.ONE.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
@ -23,7 +22,7 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) {
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) { for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/drive_viewer_${workState.name.lowercase()}"))) .modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_${workState.name.lowercase()}")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(WorkerState.SEMI_WORKER_STATE, workState) .condition(WorkerState.SEMI_WORKER_STATE, workState)
@ -35,14 +34,14 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) {
with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) { with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) {
for (facing in BlockRotationFreedom.ONE.possibleValues) { for (facing in BlockRotationFreedom.ONE.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern_storage"))) .modelFile(provider.models().getExistingFile(modLocation("block/pattern_storage")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.ONE.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
for (i in 0 .. 7) { for (i in 0 .. 7) {
part() part()
.modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern/model$i"))) .modelFile(provider.models().getExistingFile(modLocation("block/pattern/model$i")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.ONE.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
@ -53,20 +52,20 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) {
with(provider.getMultipartBuilder(MBlocks.ENERGY_COUNTER)) { with(provider.getMultipartBuilder(MBlocks.ENERGY_COUNTER)) {
// даваааййй // даваааййй
val up = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_up")) val up = provider.models().getExistingFile(modLocation("block/energy_counter_up"))
val down = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_down")) val down = provider.models().getExistingFile(modLocation("block/energy_counter_down"))
val west = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_west")) val west = provider.models().getExistingFile(modLocation("block/energy_counter_west"))
val east = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_east")) val east = provider.models().getExistingFile(modLocation("block/energy_counter_east"))
// ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ // ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ
val north = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north")) val north = provider.models().getExistingFile(modLocation("block/energy_counter_north"))
val northDown = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north_down")) val northDown = provider.models().getExistingFile(modLocation("block/energy_counter_north_down"))
val northEast = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north_east")) val northEast = provider.models().getExistingFile(modLocation("block/energy_counter_north_east"))
val northWest = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north_west")) val northWest = provider.models().getExistingFile(modLocation("block/energy_counter_north_west"))
val south = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south")) val south = provider.models().getExistingFile(modLocation("block/energy_counter_south"))
val southDown = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south_down")) val southDown = provider.models().getExistingFile(modLocation("block/energy_counter_south_down"))
val southEast = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south_east")) val southEast = provider.models().getExistingFile(modLocation("block/energy_counter_south_east"))
val southWest = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south_west")) val southWest = provider.models().getExistingFile(modLocation("block/energy_counter_south_west"))
for (dir in arrayOf(Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.NORTH)) { for (dir in arrayOf(Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.NORTH)) {
part().modelFile(down).rotationY(dir.yRotationBlockstateNorth()).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.UP).condition(EnergyCounterBlock.IF_DIRECTION, dir) part().modelFile(down).rotationY(dir.yRotationBlockstateNorth()).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.UP).condition(EnergyCounterBlock.IF_DIRECTION, dir)

View File

@ -1,6 +1,5 @@
package ru.dbotthepony.mc.otm.datagen.blocks package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.client.model.generators.BlockStateProvider import net.minecraftforge.client.model.generators.BlockStateProvider
@ -13,6 +12,7 @@ import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.LinkedList import java.util.LinkedList
typealias BlockStateTransform = (state: BlockState, builder: ConfiguredModel.Builder<*>, path: String) -> String? typealias BlockStateTransform = (state: BlockState, builder: ConfiguredModel.Builder<*>, path: String) -> String?
@ -60,7 +60,7 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
var modelPath = initialTransform(it, "block/${block.registryName!!.path}", builder) var modelPath = initialTransform(it, "block/${block.registryName!!.path}", builder)
modelPath = func(it, builder, modelPath) ?: modelPath modelPath = func(it, builder, modelPath) ?: modelPath
builder.modelFile(models().getExistingFile(ResourceLocation(DataGen.MOD_ID, modelPath))) builder.modelFile(models().getExistingFile(modLocation(modelPath)))
return@forAllStates builder.build() return@forAllStates builder.build()
} }

View File

@ -1,11 +1,8 @@
package ru.dbotthepony.mc.otm.datagen.items package ru.dbotthepony.mc.otm.datagen.items
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
@ -25,7 +22,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.block(MItems.CARBON_FIBRE_BLOCK) provider.block(MItems.CARBON_FIBRE_BLOCK)
provider.block(MItems.METAL_JUNK) provider.block(MItems.METAL_JUNK)
provider.block(MItems.METAL_MESH) provider.block(MItems.METAL_MESH)
provider.generatedTranslucent(MItems.TRITANIUM_BARS, ResourceLocation(DataGen.MOD_ID, "block/decorative/tritanium_bars")) provider.generatedTranslucent(MItems.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars"))
provider.block(MItems.DEEPSLATE_TRITANIUM_ORE) provider.block(MItems.DEEPSLATE_TRITANIUM_ORE)
provider.block(MItems.TRITANIUM_ORE) provider.block(MItems.TRITANIUM_ORE)
provider.block(MItems.TRITANIUM_STRIPED_BLOCK) provider.block(MItems.TRITANIUM_STRIPED_BLOCK)
@ -47,7 +44,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
} }
for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allItems) { for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allItems) {
provider.generatedTranslucent(glass, ResourceLocation(DataGen.MOD_ID, "block/decorative/${MRegistry.INDUSTRIAL_GLASS.allItems[color]!!.registryName!!.path}")) provider.generatedTranslucent(glass, modLocation("block/decorative/${MRegistry.INDUSTRIAL_GLASS.allItems[color]!!.registryName!!.path}"))
} }
provider.blocks(MRegistry.DECORATIVE_CRATE.allItems.values) provider.blocks(MRegistry.DECORATIVE_CRATE.allItems.values)
@ -95,9 +92,9 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.generatedTiered(MItems.BATTERIES, "battery_tier") provider.generatedTiered(MItems.BATTERIES, "battery_tier")
provider.generated(MItems.BATTERY_CREATIVE) provider.generated(MItems.BATTERY_CREATIVE)
provider.generated(MItems.MATTER_CAPACITOR_BASIC, ResourceLocation(DataGen.MOD_ID, "item/matter_capacitor_tier1")) provider.generated(MItems.MATTER_CAPACITOR_BASIC, modLocation("item/matter_capacitor_tier1"))
provider.generated(MItems.MATTER_CAPACITOR_NORMAL, ResourceLocation(DataGen.MOD_ID, "item/matter_capacitor_tier2")) provider.generated(MItems.MATTER_CAPACITOR_NORMAL, modLocation("item/matter_capacitor_tier2"))
provider.generated(MItems.MATTER_CAPACITOR_DENSE, ResourceLocation(DataGen.MOD_ID, "item/matter_capacitor_tier3")) provider.generated(MItems.MATTER_CAPACITOR_DENSE, modLocation("item/matter_capacitor_tier3"))
provider.generated(MItems.MATTER_CAPACITOR_CREATIVE) provider.generated(MItems.MATTER_CAPACITOR_CREATIVE)
provider.generated(MItems.QUANTUM_BATTERY) provider.generated(MItems.QUANTUM_BATTERY)

View File

@ -7,6 +7,7 @@ import net.minecraftforge.data.event.GatherDataEvent
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.LinkedList import java.util.LinkedList
class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) { class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
@ -23,8 +24,8 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
} }
} }
fun block(item: Item) = exec { withExistingParent(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/${item.registryName!!.path}")) } fun block(item: Item) = exec { withExistingParent(item.registryName!!.path, modLocation("block/${item.registryName!!.path}")) }
fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/$path")) } fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, modLocation("block/$path")) }
fun blocks(vararg items: Item) = items.forEach(this::block) fun blocks(vararg items: Item) = items.forEach(this::block)
fun blocks(items: Collection<Item>) = items.forEach(this::block) fun blocks(items: Collection<Item>) = items.forEach(this::block)
@ -40,18 +41,18 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
withExistingParent(item.registryName!!.path, HANDHELD).texture("layer0", texture) withExistingParent(item.registryName!!.path, HANDHELD).texture("layer0", texture)
} }
fun generated(item: Item) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${item.registryName!!.path}")) fun generated(item: Item) = generated(item, modLocation("item/${item.registryName!!.path}"))
fun generated(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } fun generated(vararg items: Item) = items.forEach { generated(it, modLocation("item/${it.registryName!!.path}")) }
fun KOT(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/ph_kitty")) } fun KOT(vararg items: Item) = items.forEach { generated(it, modLocation("block/ph_kitty")) }
fun generated(items: Collection<Item>) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } fun generated(items: Collection<Item>) = items.forEach { generated(it, modLocation("item/${it.registryName!!.path}")) }
fun generatedBlock(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/${it.registryName!!.path}")) } fun generatedBlock(vararg items: Item) = items.forEach { generated(it, modLocation("block/${it.registryName!!.path}")) }
fun generatedBlockDecorative(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/decorative/${it.registryName!!.path}")) } fun generatedBlockDecorative(vararg items: Item) = items.forEach { generated(it, modLocation("block/decorative/${it.registryName!!.path}")) }
fun handheld(vararg items: Item) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } fun handheld(vararg items: Item) = items.forEach { handheld(it, modLocation("item/${it.registryName!!.path}")) }
fun handheld(items: Collection<Item>) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } fun handheld(items: Collection<Item>) = items.forEach { handheld(it, modLocation("item/${it.registryName!!.path}")) }
fun generated(item: Item, prefix: String) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}")) fun generated(item: Item, prefix: String) = generated(item, modLocation("item/${prefix}${item.registryName!!.path}"))
fun generatedStrict(item: Item, path: String) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/$path")) fun generatedStrict(item: Item, path: String) = generated(item, modLocation("item/$path"))
fun handheld(item: Item, prefix: String) = handheld(item, ResourceLocation(DataGen.MOD_ID, "item/${prefix}${item.registryName!!.path}")) fun handheld(item: Item, prefix: String) = handheld(item, modLocation("item/${prefix}${item.registryName!!.path}"))
fun component(item: Item) = generated(item, "component/") fun component(item: Item) = generated(item, "component/")
fun components(vararg items: Item) = items.forEach(this::component) fun components(vararg items: Item) = items.forEach(this::component)
@ -63,7 +64,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
var i = 0 var i = 0
for (item in items) { for (item in items) {
generated(item, ResourceLocation(DataGen.MOD_ID, "item/$prefix$i")) generated(item, modLocation("item/$prefix$i"))
i++ i++
} }
} }
@ -72,7 +73,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
var i = 0 var i = 0
for (item in items) { for (item in items) {
generated(item, ResourceLocation(DataGen.MOD_ID, "item/$prefix$i")) generated(item, modLocation("item/$prefix$i"))
i++ i++
} }
} }

View File

@ -1,16 +1,11 @@
package ru.dbotthepony.mc.otm.datagen.models package ru.dbotthepony.mc.otm.datagen.models
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import net.minecraft.resources.ResourceLocation
import net.minecraft.server.packs.PackType
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.DoorBlock
import net.minecraftforge.client.model.generators.BlockModelProvider import net.minecraftforge.client.model.generators.BlockModelProvider
import net.minecraftforge.client.model.generators.ModelProvider
import net.minecraftforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.LinkedList import java.util.LinkedList
class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) { class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
@ -33,7 +28,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun decorativeGlassAll(blocks: Collection<Block>) { fun decorativeGlassAll(blocks: Collection<Block>) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/${block.registryName!!.path}")).renderType("translucent") cubeAll(block.registryName!!.path, modLocation("block/decorative/${block.registryName!!.path}")).renderType("translucent")
} }
} }
} }
@ -41,7 +36,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun decorativeGlassAll(vararg blocks: Block) { fun decorativeGlassAll(vararg blocks: Block) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/${block.registryName!!.path}")).renderType("translucent") cubeAll(block.registryName!!.path, modLocation("block/decorative/${block.registryName!!.path}")).renderType("translucent")
} }
} }
} }
@ -49,7 +44,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun decorativeCubeAll(vararg blocks: Block) { fun decorativeCubeAll(vararg blocks: Block) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/${block.registryName!!.path}")) cubeAll(block.registryName!!.path, modLocation("block/decorative/${block.registryName!!.path}"))
} }
} }
} }
@ -57,7 +52,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun decorativeCubeAll(subdir: String, vararg blocks: Block) { fun decorativeCubeAll(subdir: String, vararg blocks: Block) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/${subdir}/${block.registryName!!.path}")) cubeAll(block.registryName!!.path, modLocation("block/decorative/${subdir}/${block.registryName!!.path}"))
} }
} }
} }
@ -65,7 +60,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun decorativeCubeAll(subdir: String, suffix: String, vararg blocks: Block) { fun decorativeCubeAll(subdir: String, suffix: String, vararg blocks: Block) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/${subdir}/${block.registryName!!.path}$suffix")) cubeAll(block.registryName!!.path, modLocation("block/decorative/${subdir}/${block.registryName!!.path}$suffix"))
} }
} }
} }
@ -73,20 +68,20 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun decorativeCubeAll(blocks: Collection<Block>) { fun decorativeCubeAll(blocks: Collection<Block>) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/${block.registryName!!.path}")) cubeAll(block.registryName!!.path, modLocation("block/decorative/${block.registryName!!.path}"))
} }
} }
} }
fun decorativeCubeAll(block: Block, texture: String) { fun decorativeCubeAll(block: Block, texture: String) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/decorative/$texture")) cubeAll(block.registryName!!.path, modLocation("block/decorative/$texture"))
} }
} }
fun column(block: Block, end: String, side: String) { fun column(block: Block, end: String, side: String) {
exec { exec {
cubeColumn(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, end), ResourceLocation(DataGen.MOD_ID, side)) cubeColumn(block.registryName!!.path, modLocation(end), modLocation(side))
} }
} }
@ -97,7 +92,7 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
fun resourceCubeAll(vararg blocks: Block) { fun resourceCubeAll(vararg blocks: Block) {
for (block in blocks) { for (block in blocks) {
exec { exec {
cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/resource/${block.registryName!!.path}")) cubeAll(block.registryName!!.path, modLocation("block/resource/${block.registryName!!.path}"))
} }
} }
} }

View File

@ -22,13 +22,13 @@ fun addBlastingRecipes(consumer: Consumer<FinishedRecipe>) {
RecipeCategory.MISC, RecipeCategory.MISC,
MItems.TRITANIUM_NUGGET, MItems.TRITANIUM_NUGGET,
0f, 200 0f, 200
).unlockedBy(MItems.TRITANIUM_NUGGET).save(consumer, modLocation("cooking/nugget_from_${tool.registryName!!.path}")) ).unlockedBy(MItems.TRITANIUM_NUGGET).save(consumer, modLocation("smelting/tritanium_nugget_from_${tool.registryName!!.path}"))
SimpleCookingRecipeBuilder.blasting( SimpleCookingRecipeBuilder.blasting(
Ingredient.of(tool), Ingredient.of(tool),
RecipeCategory.MISC, RecipeCategory.MISC,
MItems.TRITANIUM_NUGGET, MItems.TRITANIUM_NUGGET,
0f, 100 0f, 100
).unlockedBy(MItems.TRITANIUM_NUGGET).save(consumer, modLocation("blasting/nugget_from_${tool.registryName!!.path}")) ).unlockedBy(MItems.TRITANIUM_NUGGET).save(consumer, modLocation("blasting/tritanium_nugget_from_${tool.registryName!!.path}"))
} }
} }

View File

@ -1,17 +1,13 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.* import net.minecraft.data.recipes.*
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.ItemTags
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import net.minecraftforge.common.Tags import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
@ -47,7 +43,7 @@ private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consume
SingleItemRecipeBuilder SingleItemRecipeBuilder
.stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount) .stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount)
.unlockedBy(base) .unlockedBy(base)
.save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}")) .save(consumer, modLocation("stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}"))
} }
private fun stairsWithCut(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) { private fun stairsWithCut(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {

View File

@ -16,6 +16,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.core.collect.JsonArrayCollector import ru.dbotthepony.mc.otm.core.collect.JsonArrayCollector
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.core.set import ru.dbotthepony.mc.otm.core.set
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.EnergyContainerRecipe import ru.dbotthepony.mc.otm.recipe.EnergyContainerRecipe
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import java.util.function.Consumer import java.util.function.Consumer
@ -189,7 +190,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
val builder = buildRegular() val builder = buildRegular()
if (name != null) { if (name != null) {
builder.save(filter(consumer), ResourceLocation(OverdriveThatMatters.MOD_ID, builder.save(filter(consumer), modLocation(
if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID) if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID)
"${result.asItem().registryName!!.path}_$name" "${result.asItem().registryName!!.path}_$name"
else else

View File

@ -16,7 +16,7 @@ import net.minecraft.world.item.Item
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.core.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
import java.util.LinkedList import java.util.LinkedList
import java.util.function.Consumer import java.util.function.Consumer
@ -82,7 +82,7 @@ class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generat
fun plate(id: String, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) { fun plate(id: String, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
exec { _, consumer -> exec { _, consumer ->
consumer.accept(PlatePressShallowFinishedRecipe( consumer.accept(PlatePressShallowFinishedRecipe(
ResourceLocation(DataGen.MOD_ID, "plates/$id"), modLocation("plates/$id"),
ResourceLocation("forge", "ingots/$id"), ResourceLocation("forge", "ingots/$id"),
ResourceLocation("forge", "plates/$id"), ResourceLocation("forge", "plates/$id"),
count, count,
@ -94,7 +94,7 @@ class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generat
fun plate(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) { fun plate(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
exec { it, callback -> exec { it, callback ->
callback.accept(PlatePressFinishedRecipe(PlatePressRecipe(ResourceLocation(DataGen.MOD_ID, "plate_$id"), ingredient, result, count, workTicks, experience = experience))) callback.accept(PlatePressFinishedRecipe(PlatePressRecipe(modLocation("plate_$id"), ingredient, result, count, workTicks, experience = experience)))
} }
} }
} }

View File

@ -3,20 +3,19 @@ package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer import java.util.function.Consumer
fun addOreSmeltingRecipes(consumer: Consumer<FinishedRecipe>) { fun addOreSmeltingRecipes(consumer: Consumer<FinishedRecipe>) {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_ore_block")) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("smelting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_ore_block")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("blasting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_raw_ore")) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("smelting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_raw_ore")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("blasting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "smelting/tritanium_ingot_from_dust")) SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("smelting/tritanium_ingot_from_dust"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/tritanium_ingot_from_dust")) SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("blasting/tritanium_ingot_from_dust"))
} }