Update datagen for previous commit

This commit is contained in:
DBotThePony 2022-05-15 14:13:13 +07:00
parent 0c8363f3c7
commit 07efb6ed85
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 109 additions and 8 deletions

View File

@ -193,6 +193,8 @@ object DataGen {
block(MBlocks.PLATE_PRESS) block(MBlocks.PLATE_PRESS)
block(MBlocks.GRAVITATION_STABILIZER) block(MBlocks.GRAVITATION_STABILIZER)
block(MBlocks.GRAVITATION_STABILIZER_LENS) block(MBlocks.GRAVITATION_STABILIZER_LENS)
block(MBlocks.STORAGE_POWER_SUPPLIER)
} }
with(itemModelProvider) { with(itemModelProvider) {
@ -243,7 +245,7 @@ object DataGen {
generated(MItems.PATTERN_DRIVE_CREATIVE) generated(MItems.PATTERN_DRIVE_CREATIVE)
for (item in MItems.CARGO_CRATES) { for (item in MItems.CARGO_CRATES) {
block(item, "${item.registryName!!.path}_closed") // block(item, "${item.registryName!!.path}_closed")
} }
block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working") block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working")

View File

@ -4,9 +4,12 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraftforge.client.model.generators.ItemModelProvider import net.minecraftforge.client.model.generators.ItemModelProvider
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
private data class SimpleItemModel(val item: String, val path: ResourceLocation) private data class SimpleItemModel(val item: String, val path: ResourceLocation) {
val traceback = IllegalArgumentException("Failed to register model")
}
class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) { class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event.generator, DataGen.MOD_ID, event.existingFileHelper) {
private val generated = ArrayList<SimpleItemModel>() private val generated = ArrayList<SimpleItemModel>()
@ -14,16 +17,37 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
private val delegates = ArrayList<SimpleItemModel>() private val delegates = ArrayList<SimpleItemModel>()
override fun registerModels() { override fun registerModels() {
for ((item, path) in generated) { for (obj in generated) {
withExistingParent(item, GENERATED).texture("layer0", path) val (item, path) = obj
try {
withExistingParent(item, GENERATED).texture("layer0", path)
} catch(err: Throwable) {
LOGGER.error(err, obj.traceback)
throw err
}
} }
for ((item, path) in handheld) { for (obj in handheld) {
withExistingParent(item, HANDHELD).texture("layer0", path) val (item, path) = obj
try {
withExistingParent(item, HANDHELD).texture("layer0", path)
} catch(err: Throwable) {
LOGGER.error(err, obj.traceback)
throw err
}
} }
for ((item, path) in delegates) { for (obj in delegates) {
withExistingParent(item, path) val (item, path) = obj
try {
withExistingParent(item, path)
} catch(err: Throwable) {
LOGGER.error(err, obj.traceback)
throw err
}
} }
} }
@ -77,5 +101,6 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
companion object { companion object {
private val GENERATED = ResourceLocation("minecraft", "item/generated") private val GENERATED = ResourceLocation("minecraft", "item/generated")
private val HANDHELD = ResourceLocation("minecraft", "item/handheld") private val HANDHELD = ResourceLocation("minecraft", "item/handheld")
private val LOGGER = LogManager.getLogger()
} }
} }

View File

@ -0,0 +1,74 @@
{
"multipart": [
{
"apply": {
"model": "overdrive_that_matters:block/storage_cable_core"
}
},
{
"when": {
"connect_south": true
},
"apply": {
"model": "overdrive_that_matters:block/storage_cable_connection"
}
},
{
"when": {
"connect_west": true
},
"apply": {
"model": "overdrive_that_matters:block/storage_cable_connection",
"y": 90
}
},
{
"when": {
"connect_north": true
},
"apply": {
"model": "overdrive_that_matters:block/storage_cable_connection",
"y": 180
}
},
{
"when": {
"connect_east": true
},
"apply": {
"model": "overdrive_that_matters:block/storage_cable_connection",
"y": 270
}
},
{
"when": {
"connect_up": true
},
"apply": {
"model": "overdrive_that_matters:block/storage_cable_connection",
"x": 90
}
},
{
"when": {
"connect_down": true
},
"apply": {
"model": "overdrive_that_matters:block/storage_cable_connection",
"x": 270
}
}
]
}