diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt index bc1ecb353..0a921075f 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.datagen -import net.minecraft.resources.ResourceLocation import net.minecraft.world.level.block.AnvilBlock import net.minecraft.world.level.block.SlabBlock 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.ConfiguredModel 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.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth @@ -200,13 +198,13 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr var labLampOff: BlockModelBuilder? = null blockModelProvider.exec { - val top = ResourceLocation(DataGen.MOD_ID, "block/decorative/metal_beam_top") + val top = modLocation("block/decorative/metal_beam_top") labLampOn = it.cube( MBlocks.LABORATORY_LAMP.registryName!!.path, top, top, - ResourceLocation(DataGen.MOD_ID, "block/decorative/laboratory_lamp_front"), + modLocation("block/decorative/laboratory_lamp_front"), top, top, top, @@ -216,7 +214,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr MBlocks.LABORATORY_LAMP.registryName!!.path + "_unlit", top, top, - ResourceLocation(DataGen.MOD_ID, "block/decorative/laboratory_lamp_front_off"), + modLocation("block/decorative/laboratory_lamp_front_off"), top, top, top, @@ -248,11 +246,11 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr blockModelProvider.exec { 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("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("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) { val name = MRegistry.INDUSTRIAL_GLASS.allBlocks[color]!!.registryName!!.path - val textureSide = ResourceLocation(DataGen.MOD_ID, "block/decorative/$name") - val textureRailing = ResourceLocation(DataGen.MOD_ID, "block/decorative/industrial_glass_frame") + val textureSide = modLocation("block/decorative/$name") + val textureRailing = modLocation("block/decorative/industrial_glass_frame") 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) itemModelProvider.block(MItems.ENGINE) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt index 20884bc5d..66444f883 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/Banks.kt @@ -1,6 +1,5 @@ package ru.dbotthepony.mc.otm.datagen.blocks -import net.minecraft.resources.ResourceLocation import net.minecraft.world.level.block.Block import net.minecraftforge.client.model.generators.BlockStateProvider 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.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.datagen.DataGen +import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.registry.MBlocks private fun nothingOrNumber(input: Int): String { @@ -27,7 +27,7 @@ open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(even with(getVariantBuilder(registry)) { forAllStates { ConfiguredModel.builder() - .modelFile(models().getExistingFile(ResourceLocation("overdrive_that_matters:block/$block"))) + .modelFile(models().getExistingFile(modLocation("block/$block"))) .rotationY(it[BlockRotationFreedom.ONE.property].front.yRotationBlockstateNorth()) .build() } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt index 6fb27fc90..f985ac4e1 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/BlockStates.kt @@ -1,10 +1,8 @@ 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.DoubleBlockHalf 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.decorative.CargoCrateBlock import ru.dbotthepony.mc.otm.block.entity.WorkerState @@ -50,7 +48,7 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) { for (dir in BlockRotationFreedom.ONE.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()) .addModel() .condition(BlockRotationFreedom.ONE.property, dir) @@ -61,14 +59,14 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { for (dir in BlockRotationFreedom.ONE.possibleValues) { 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()) .addModel() .condition(BlockRotationFreedom.ONE.property, dir) .condition(enum, false) .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()) .addModel() .condition(BlockRotationFreedom.ONE.property, dir) @@ -98,8 +96,7 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { return@forAllStates arrayOf( ConfiguredModel.builder() .modelFile(provider.models().getExistingFile( - ResourceLocation( - OverdriveThatMatters.MOD_ID, "${crate.registryName!!.path}_${if (it.getValue( + modLocation("${crate.registryName!!.path}_${if (it.getValue( CargoCrateBlock.IS_OPEN)) "open" else "closed"}") )) .rotationY(it.getValue(BlockRotationFreedom.ONE.property).front.yRotationBlockstateNorth()) @@ -110,14 +107,14 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { with(provider.getMultipartBuilder(MBlocks.STORAGE_BUS)) { 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()) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() .condition(BlockRotationFreedom.TWO.property, dir) .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()) .rotationY(dir.front.yRotationBlockstateSouth()) .addModel() @@ -125,20 +122,20 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { .end() } - part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_core"))) + part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core"))) .addModel().end() } with(provider.getMultipartBuilder(MBlocks.STORAGE_IMPORTER)) { 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()) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() .condition(BlockRotationFreedom.TWO.property, dir) .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()) .rotationY(dir.front.yRotationBlockstateSouth()) .addModel() @@ -146,20 +143,20 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { .end() } - part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_core"))) + part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core"))) .addModel().end() } with(provider.getMultipartBuilder(MBlocks.STORAGE_EXPORTER)) { 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()) .rotationY(dir.front.yRotationBlockstateNorth()) .addModel() .condition(BlockRotationFreedom.TWO.property, dir) .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()) .rotationY(dir.front.yRotationBlockstateSouth()) .addModel() @@ -167,7 +164,7 @@ fun addBlockStates(provider: MatteryBlockStateProvider) { .end() } - part().modelFile(provider.models().getExistingFile(ResourceLocation(OverdriveThatMatters.MOD_ID, "storage_cable_core"))) + part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core"))) .addModel().end() } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt index 16711d918..73ee45bf9 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/ComplexBlockStates.kt @@ -1,21 +1,20 @@ package ru.dbotthepony.mc.otm.datagen.blocks import net.minecraft.core.Direction -import net.minecraft.resources.ResourceLocation import ru.dbotthepony.mc.otm.block.tech.EnergyCounterBlock import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.matter.PatternStorageBlock import ru.dbotthepony.mc.otm.block.storage.DriveViewerBlock import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom 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 fun addComplexBlockStates(provider: MatteryBlockStateProvider) { with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) { for (facing in BlockRotationFreedom.ONE.possibleValues) { 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()) .addModel() .condition(BlockRotationFreedom.ONE.property, facing) @@ -23,7 +22,7 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) { for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) { 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()) .addModel() .condition(WorkerState.SEMI_WORKER_STATE, workState) @@ -35,14 +34,14 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) { with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) { for (facing in BlockRotationFreedom.ONE.possibleValues) { part() - .modelFile(provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/pattern_storage"))) + .modelFile(provider.models().getExistingFile(modLocation("block/pattern_storage"))) .rotationY(facing.front.yRotationBlockstateNorth()) .addModel() .condition(BlockRotationFreedom.ONE.property, facing) for (i in 0 .. 7) { 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()) .addModel() .condition(BlockRotationFreedom.ONE.property, facing) @@ -53,20 +52,20 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) { with(provider.getMultipartBuilder(MBlocks.ENERGY_COUNTER)) { // даваааййй - val up = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_up")) - val down = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_down")) - val west = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_west")) - val east = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_east")) + val up = provider.models().getExistingFile(modLocation("block/energy_counter_up")) + val down = provider.models().getExistingFile(modLocation("block/energy_counter_down")) + val west = provider.models().getExistingFile(modLocation("block/energy_counter_west")) + val east = provider.models().getExistingFile(modLocation("block/energy_counter_east")) // ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ - val north = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north")) - val northDown = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north_down")) - val northEast = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north_east")) - val northWest = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_north_west")) - val south = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south")) - val southDown = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south_down")) - val southEast = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south_east")) - val southWest = provider.models().getExistingFile(ResourceLocation(MOD_ID, "block/energy_counter_south_west")) + val north = provider.models().getExistingFile(modLocation("block/energy_counter_north")) + val northDown = provider.models().getExistingFile(modLocation("block/energy_counter_north_down")) + val northEast = provider.models().getExistingFile(modLocation("block/energy_counter_north_east")) + val northWest = provider.models().getExistingFile(modLocation("block/energy_counter_north_west")) + val south = provider.models().getExistingFile(modLocation("block/energy_counter_south")) + val southDown = provider.models().getExistingFile(modLocation("block/energy_counter_south_down")) + val southEast = provider.models().getExistingFile(modLocation("block/energy_counter_south_east")) + val southWest = provider.models().getExistingFile(modLocation("block/energy_counter_south_west")) 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) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt index 90babe7c9..b9b99e438 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/blocks/MatteryBlockStateProvider.kt @@ -1,6 +1,5 @@ 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.state.BlockState 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.datagen.DataGen import ru.dbotthepony.mc.otm.core.registryName +import ru.dbotthepony.mc.otm.datagen.modLocation import java.util.LinkedList 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) 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() } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt index 17f3f29e0..69ab5482e 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/ItemModels.kt @@ -1,11 +1,8 @@ package ru.dbotthepony.mc.otm.datagen.items -import net.minecraft.resources.ResourceLocation import net.minecraft.world.item.DyeColor 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.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MRegistry @@ -25,7 +22,7 @@ fun addItemModels(provider: MatteryItemModelProvider) { provider.block(MItems.CARBON_FIBRE_BLOCK) provider.block(MItems.METAL_JUNK) 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.TRITANIUM_ORE) provider.block(MItems.TRITANIUM_STRIPED_BLOCK) @@ -47,7 +44,7 @@ fun addItemModels(provider: MatteryItemModelProvider) { } 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) @@ -95,9 +92,9 @@ fun addItemModels(provider: MatteryItemModelProvider) { provider.generatedTiered(MItems.BATTERIES, "battery_tier") provider.generated(MItems.BATTERY_CREATIVE) - provider.generated(MItems.MATTER_CAPACITOR_BASIC, ResourceLocation(DataGen.MOD_ID, "item/matter_capacitor_tier1")) - provider.generated(MItems.MATTER_CAPACITOR_NORMAL, ResourceLocation(DataGen.MOD_ID, "item/matter_capacitor_tier2")) - provider.generated(MItems.MATTER_CAPACITOR_DENSE, ResourceLocation(DataGen.MOD_ID, "item/matter_capacitor_tier3")) + provider.generated(MItems.MATTER_CAPACITOR_BASIC, modLocation("item/matter_capacitor_tier1")) + provider.generated(MItems.MATTER_CAPACITOR_NORMAL, modLocation("item/matter_capacitor_tier2")) + provider.generated(MItems.MATTER_CAPACITOR_DENSE, modLocation("item/matter_capacitor_tier3")) provider.generated(MItems.MATTER_CAPACITOR_CREATIVE) provider.generated(MItems.QUANTUM_BATTERY) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/MatteryItemModelProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/MatteryItemModelProvider.kt index 75e41c5d2..643c6e77b 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/MatteryItemModelProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/items/MatteryItemModelProvider.kt @@ -7,6 +7,7 @@ import net.minecraftforge.data.event.GatherDataEvent import org.apache.logging.log4j.LogManager import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.core.registryName +import ru.dbotthepony.mc.otm.datagen.modLocation import java.util.LinkedList 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, path: String) = exec { withExistingParent(item.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/$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, modLocation("block/$path")) } fun blocks(vararg items: Item) = items.forEach(this::block) fun blocks(items: Collection) = items.forEach(this::block) @@ -40,18 +41,18 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event withExistingParent(item.registryName!!.path, HANDHELD).texture("layer0", texture) } - fun generated(item: Item) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/${item.registryName!!.path}")) - fun generated(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } - fun KOT(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/ph_kitty")) } - fun generated(items: Collection) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } - fun generatedBlock(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/${it.registryName!!.path}")) } - fun generatedBlockDecorative(vararg items: Item) = items.forEach { generated(it, ResourceLocation(DataGen.MOD_ID, "block/decorative/${it.registryName!!.path}")) } - fun handheld(vararg items: Item) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } - fun handheld(items: Collection) = items.forEach { handheld(it, ResourceLocation(DataGen.MOD_ID, "item/${it.registryName!!.path}")) } + fun generated(item: Item) = generated(item, modLocation("item/${item.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, modLocation("block/ph_kitty")) } + fun generated(items: Collection) = items.forEach { generated(it, modLocation("item/${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, modLocation("block/decorative/${it.registryName!!.path}")) } + fun handheld(vararg items: Item) = items.forEach { handheld(it, modLocation("item/${it.registryName!!.path}")) } + fun handheld(items: Collection) = 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 generatedStrict(item: Item, path: String) = generated(item, ResourceLocation(DataGen.MOD_ID, "item/$path")) - fun handheld(item: Item, prefix: String) = handheld(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, modLocation("item/$path")) + fun handheld(item: Item, prefix: String) = handheld(item, modLocation("item/${prefix}${item.registryName!!.path}")) fun component(item: Item) = generated(item, "component/") fun components(vararg items: Item) = items.forEach(this::component) @@ -63,7 +64,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event var i = 0 for (item in items) { - generated(item, ResourceLocation(DataGen.MOD_ID, "item/$prefix$i")) + generated(item, modLocation("item/$prefix$i")) i++ } } @@ -72,7 +73,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event var i = 0 for (item in items) { - generated(item, ResourceLocation(DataGen.MOD_ID, "item/$prefix$i")) + generated(item, modLocation("item/$prefix$i")) i++ } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt index cec8563c5..f2cdb8a5e 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/models/MatteryModelProvider.kt @@ -1,16 +1,11 @@ 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.DoorBlock import net.minecraftforge.client.model.generators.BlockModelProvider -import net.minecraftforge.client.model.generators.ModelProvider import net.minecraftforge.data.event.GatherDataEvent import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.core.registryName +import ru.dbotthepony.mc.otm.datagen.modLocation import java.util.LinkedList 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) { for (block in blocks) { 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) { for (block in blocks) { 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) { for (block in blocks) { 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) { for (block in blocks) { 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) { for (block in blocks) { 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) { for (block in blocks) { 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) { 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) { 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) { for (block in blocks) { exec { - cubeAll(block.registryName!!.path, ResourceLocation(DataGen.MOD_ID, "block/resource/${block.registryName!!.path}")) + cubeAll(block.registryName!!.path, modLocation("block/resource/${block.registryName!!.path}")) } } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt index 1ffe1f3d2..30479a59e 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/BlastingRecipes.kt @@ -22,13 +22,13 @@ fun addBlastingRecipes(consumer: Consumer) { RecipeCategory.MISC, MItems.TRITANIUM_NUGGET, 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( Ingredient.of(tool), RecipeCategory.MISC, MItems.TRITANIUM_NUGGET, 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}")) } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/DecorativesRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/DecorativesRecipes.kt index 45706fbfc..f126765f7 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/DecorativesRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/DecorativesRecipes.kt @@ -1,17 +1,13 @@ package ru.dbotthepony.mc.otm.datagen.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.ItemStack import net.minecraft.world.item.Items import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.level.ItemLike import net.minecraftforge.common.Tags -import ru.dbotthepony.mc.otm.OverdriveThatMatters 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.registry.MBlocks import ru.dbotthepony.mc.otm.registry.MItemTags @@ -47,7 +43,7 @@ private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consume SingleItemRecipeBuilder .stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount) .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) { diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipe.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipe.kt index a5deb984e..df82b17aa 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipe.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipe.kt @@ -16,6 +16,7 @@ import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.core.collect.JsonArrayCollector import ru.dbotthepony.mc.otm.core.registryName 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.UpgradeRecipe import java.util.function.Consumer @@ -189,7 +190,7 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci val builder = buildRegular() if (name != null) { - builder.save(filter(consumer), ResourceLocation(OverdriveThatMatters.MOD_ID, + builder.save(filter(consumer), modLocation( if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID) "${result.asItem().registryName!!.path}_$name" else diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipeProvider.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipeProvider.kt index 2ca4c8940..c034f6803 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipeProvider.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/MatteryRecipeProvider.kt @@ -16,7 +16,7 @@ import net.minecraft.world.item.Item import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.level.ItemLike 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 java.util.LinkedList 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) { exec { _, consumer -> consumer.accept(PlatePressShallowFinishedRecipe( - ResourceLocation(DataGen.MOD_ID, "plates/$id"), + modLocation("plates/$id"), ResourceLocation("forge", "ingots/$id"), ResourceLocation("forge", "plates/$id"), 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) { 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))) } } } diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/OreRecipes.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/OreRecipes.kt index f3a50e642..977a208a3 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/OreRecipes.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/recipes/OreRecipes.kt @@ -3,20 +3,19 @@ package ru.dbotthepony.mc.otm.datagen.recipes import net.minecraft.data.recipes.FinishedRecipe import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.SimpleCookingRecipeBuilder -import net.minecraft.resources.ResourceLocation 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.MItems import java.util.function.Consumer fun addOreSmeltingRecipes(consumer: Consumer) { - 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, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/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.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, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/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.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, ResourceLocation(OverdriveThatMatters.MOD_ID, "blasting/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.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")) }