Colored floor tiles and tritanium block

This commit is contained in:
DBotThePony 2022-05-16 19:08:25 +07:00
parent 3e9751f1b5
commit 8d7b73080f
Signed by: DBot
GPG Key ID: DCC23B5715498507
38 changed files with 316 additions and 39 deletions

85
colorizer.js Normal file
View File

@ -0,0 +1,85 @@
// Использует Image Magick для автоматической перекраски текстур
const fs = require('fs')
const root_main = './src/main/resources/assets/overdrive_that_matters/textures/'
const child_process = require('child_process')
const args = process.argv.slice(2)
if (args.length == 0) {
console.error('No texture(s) names specified.')
process.exit(2)
}
const colors = [
['orange', [245, 116, 16]],
['magenta', [186, 63, 175]],
['light_blue', [59, 180, 219]],
['yellow', [252, 199, 36]],
['lime', [111, 187, 24]],
['pink', [243, 139, 170]],
['gray', [62, 66, 70]],
['light_gray', [140, 140, 131]],
['cyan', [22, 134, 145]],
['purple', [116, 38, 169]],
['blue', [51, 53, 155]],
['brown', [114, 71, 40]],
['green', [84, 109, 28]],
['red', [156, 37, 34]],
['black', [31, 31, 35]],
]
process.stderr.setMaxListeners(40)
process.stdout.setMaxListeners(40)
for (const texture of args) {
if (!fs.existsSync(`${root_main}${texture}.png`)) {
process.stderr.write(`${texture}.png does not exist\n`)
continue
}
const splitted = texture.split('/')
const last = splitted.pop()
const combined = splitted.join('/')
const basedir = `${root_main}${combined}`
for (const color of colors) {
(async function() {
const identify = child_process.spawn('magick', [
'identify',
`${root_main}${texture}.png`,
])
identify.stderr.pipe(process.stderr)
const chunks = []
identify.stdout.on('data', (a) => chunks.push(a))
await new Promise((resolve) => {
identify.on('close', () => resolve())
})
const chunk = chunks[0].toString('utf-8')
const size = chunk.match(/PNG ([0-9]+)x([0-9]+)/)
const width = parseInt(size[1])
const height = parseInt(size[2])
const name = color[0]
const rgb = color[1]
const magick = child_process.spawn('magick', [
'convert',
`${root_main}${texture}.png`,
'-size', `${width}x${height}`,
`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`,
'-compose', 'Multiply',
'-composite',
//'-layers', 'merge',
`${basedir}/${last.replace(/_colorless/, '').replace(/_white/, '')}_${name}.png`])
magick.stdout.pipe(process.stdout)
magick.stderr.pipe(process.stderr)
})()
}
}

View File

@ -18,8 +18,6 @@ import net.minecraftforge.fml.common.Mod
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent import net.minecraftforge.forge.event.lifecycle.GatherDataEvent
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.block.* import ru.dbotthepony.mc.otm.block.*
import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState
import ru.dbotthepony.mc.otm.data.LootTableBasicAppender import ru.dbotthepony.mc.otm.data.LootTableBasicAppender
import ru.dbotthepony.mc.otm.datagen.blocks.BatteryBankProvider import ru.dbotthepony.mc.otm.datagen.blocks.BatteryBankProvider
@ -32,8 +30,7 @@ import ru.dbotthepony.mc.otm.datagen.loot.TileNbtCopy
import ru.dbotthepony.mc.otm.datagen.models.BlockMatteryModelProvider import ru.dbotthepony.mc.otm.datagen.models.BlockMatteryModelProvider
import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipeProvider import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipeProvider
import ru.dbotthepony.mc.otm.datagen.recipes.has import ru.dbotthepony.mc.otm.datagen.recipes.has
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.*
import ru.dbotthepony.mc.otm.registry.MNames
@Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
object DataGen { object DataGen {
@ -108,6 +105,17 @@ object DataGen {
} }
} }
private fun decoratives(list: ColoredDecorativeBlock) {
for (block in list.blocks) {
decorativeCubeAll(block)
lootTableProvider.simpleBlock(block)
}
for (item in list.items) {
itemModelProvider.block(item)
}
}
@SubscribeEvent @SubscribeEvent
@JvmStatic @JvmStatic
@Suppress("unused") @Suppress("unused")
@ -131,10 +139,11 @@ object DataGen {
decorativeCubeAll(MBlocks.CRATE_LIST) decorativeCubeAll(MBlocks.CRATE_LIST)
decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK) decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK)
decorativeCubeAll(MBlocks.TRITANIUM_BLOCK) decorativeCubeAll(MBlocks.TRITANIUM_BLOCK)
decorativeCubeAll(MBlocks.TRITANIUM_BLOCK_COLORLESS)
decorativeCubeAll(MBlocks.VENT) decorativeCubeAll(MBlocks.VENT)
decorativeCubeAll(MBlocks.VENT_ALTERNATIVE) decorativeCubeAll(MBlocks.VENT_ALTERNATIVE)
decorativeCubeAll(MBlocks.FLOOR_TILES)
decoratives(MRegistry.TRITANIUM_BLOCK)
decoratives(MRegistry.FLOOR_TILES)
for (glass in MBlocks.INDUSTRIAL_GLASS_LIST) { for (glass in MBlocks.INDUSTRIAL_GLASS_LIST) {
decorativeCubeAll(glass) decorativeCubeAll(glass)
@ -305,10 +314,8 @@ object DataGen {
block(MItems.TRITANIUM_RAW_BLOCK) block(MItems.TRITANIUM_RAW_BLOCK)
block(MItems.ITEM_MONITOR) block(MItems.ITEM_MONITOR)
block(MItems.TRITANIUM_BLOCK) block(MItems.TRITANIUM_BLOCK)
block(MItems.TRITANIUM_BLOCK_COLORLESS)
block(MItems.VENT) block(MItems.VENT)
block(MItems.VENT_ALTERNATIVE) block(MItems.VENT_ALTERNATIVE)
block(MItems.FLOOR_TILES)
for (glass in MItems.INDUSTRIAL_GLASS_LIST) { for (glass in MItems.INDUSTRIAL_GLASS_LIST) {
block(glass) block(glass)
@ -465,10 +472,8 @@ object DataGen {
simpleBlock(MBlocks.CARBON_FIBRE_BLOCK) simpleBlock(MBlocks.CARBON_FIBRE_BLOCK)
simpleBlock(MBlocks.TRITANIUM_RAW_BLOCK) simpleBlock(MBlocks.TRITANIUM_RAW_BLOCK)
simpleBlock(MBlocks.TRITANIUM_BLOCK) simpleBlock(MBlocks.TRITANIUM_BLOCK)
simpleBlock(MBlocks.TRITANIUM_BLOCK_COLORLESS)
simpleBlock(MBlocks.VENT) simpleBlock(MBlocks.VENT)
simpleBlock(MBlocks.VENT_ALTERNATIVE) simpleBlock(MBlocks.VENT_ALTERNATIVE)
simpleBlock(MBlocks.FLOOR_TILES)
simpleBlock(MBlocks.TRITANIUM_STRIPED_BLOCK) simpleBlock(MBlocks.TRITANIUM_STRIPED_BLOCK)
simpleBlock(MBlocks.MATTER_CABLE) simpleBlock(MBlocks.MATTER_CABLE)
simpleBlock(MBlocks.GRAVITATION_STABILIZER) simpleBlock(MBlocks.GRAVITATION_STABILIZER)

View File

@ -17,6 +17,7 @@ import net.minecraftforge.registries.ForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.block.* import ru.dbotthepony.mc.otm.block.*
object MBlocks { object MBlocks {
private val registry = DeferredRegister.create(ForgeRegistries.BLOCKS, OverdriveThatMatters.MOD_ID) private val registry = DeferredRegister.create(ForgeRegistries.BLOCKS, OverdriveThatMatters.MOD_ID)
@ -97,13 +98,9 @@ object MBlocks {
.strength(4f) .strength(4f)
) } ) }
val TRITANIUM_BLOCK_COLORLESS: Block by registry.register(MNames.TRITANIUM_BLOCK_COLORLESS) { Block( init {
BlockBehaviour.Properties.of(Material.METAL, DyeColor.WHITE) MRegistry.TRITANIUM_BLOCK.registerBlocks(registry)
.sound(SoundType.BASALT) }
.requiresCorrectToolForDrops()
.explosionResistance(80f)
.strength(4f)
) }
val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block( val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE) BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
@ -121,13 +118,6 @@ object MBlocks {
.strength(3f) .strength(3f)
) } ) }
val FLOOR_TILES: Block by registry.register(MNames.FLOOR_TILES) { Block(
BlockBehaviour.Properties.of(Material.STONE, MaterialColor.COLOR_LIGHT_GRAY)
.sound(SoundType.STONE)
.requiresCorrectToolForDrops()
.strength(3f)
) }
val VENT: Block by registry.register(MNames.VENT) { Block( val VENT: Block by registry.register(MNames.VENT) { Block(
BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE) BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE)
.sound(SoundType.BASALT) .sound(SoundType.BASALT)
@ -144,6 +134,10 @@ object MBlocks {
.strength(4f) .strength(4f)
) } ) }
init {
MRegistry.FLOOR_TILES.registerBlocks(registry)
}
val CARGO_CRATE: Block by registry.register(MNames.CARGO_CRATE) { CargoCrateBlock(null) } val CARGO_CRATE: Block by registry.register(MNames.CARGO_CRATE) { CargoCrateBlock(null) }
val CARGO_CRATE_WHITE: Block by registry.register(MNames.CARGO_CRATE_WHITE) { CargoCrateBlock(DyeColor.WHITE) } val CARGO_CRATE_WHITE: Block by registry.register(MNames.CARGO_CRATE_WHITE) { CargoCrateBlock(DyeColor.WHITE) }
val CARGO_CRATE_ORANGE: Block by registry.register(MNames.CARGO_CRATE_ORANGE) { CargoCrateBlock(DyeColor.ORANGE) } val CARGO_CRATE_ORANGE: Block by registry.register(MNames.CARGO_CRATE_ORANGE) { CargoCrateBlock(DyeColor.ORANGE) }

View File

@ -291,13 +291,21 @@ object MItems {
) )
val TRITANIUM_BLOCK: Item by registry.register(MNames.TRITANIUM_BLOCK) { BlockItem(MBlocks.TRITANIUM_BLOCK, DEFAULT_PROPERTIES) } val TRITANIUM_BLOCK: Item by registry.register(MNames.TRITANIUM_BLOCK) { BlockItem(MBlocks.TRITANIUM_BLOCK, DEFAULT_PROPERTIES) }
val TRITANIUM_BLOCK_COLORLESS: Item by registry.register(MNames.TRITANIUM_BLOCK_COLORLESS) { BlockItem(MBlocks.TRITANIUM_BLOCK_COLORLESS, DEFAULT_PROPERTIES) }
init {
MRegistry.TRITANIUM_BLOCK.registerItems(registry)
}
val VENT: Item by registry.register(MNames.VENT) { BlockItem(MBlocks.VENT, DEFAULT_PROPERTIES) } val VENT: Item by registry.register(MNames.VENT) { BlockItem(MBlocks.VENT, DEFAULT_PROPERTIES) }
val VENT_ALTERNATIVE: Item by registry.register(MNames.VENT_ALTERNATIVE) { BlockItem(MBlocks.VENT_ALTERNATIVE, DEFAULT_PROPERTIES) } val VENT_ALTERNATIVE: Item by registry.register(MNames.VENT_ALTERNATIVE) { BlockItem(MBlocks.VENT_ALTERNATIVE, DEFAULT_PROPERTIES) }
val FLOOR_TILES: Item by registry.register(MNames.FLOOR_TILES) { BlockItem(MBlocks.FLOOR_TILES, DEFAULT_PROPERTIES) }
val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES) } val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES) }
val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES) } val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES) }
init {
MRegistry.FLOOR_TILES.registerItems(registry)
}
val INDUSTRIAL_GLASS: Item by registry.register(MRegistry.INDUSTRIAL_GLASS.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS, DEFAULT_PROPERTIES) } val INDUSTRIAL_GLASS: Item by registry.register(MRegistry.INDUSTRIAL_GLASS.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_WHITE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_WHITE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_WHITE, DEFAULT_PROPERTIES) } val INDUSTRIAL_GLASS_WHITE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_WHITE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_WHITE, DEFAULT_PROPERTIES) }
val INDUSTRIAL_GLASS_ORANGE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_ORANGE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_ORANGE, DEFAULT_PROPERTIES) } val INDUSTRIAL_GLASS_ORANGE: Item by registry.register(MRegistry.INDUSTRIAL_GLASS_ORANGE.name) { BlockItem(MBlocks.INDUSTRIAL_GLASS_ORANGE, DEFAULT_PROPERTIES) }

View File

@ -58,7 +58,6 @@ object MNames {
// building blocks // building blocks
const val TRITANIUM_BLOCK = "tritanium_block" const val TRITANIUM_BLOCK = "tritanium_block"
const val TRITANIUM_BLOCK_COLORLESS = "tritanium_block_colorless"
const val TRITANIUM_STRIPED_BLOCK = "tritanium_striped_block" const val TRITANIUM_STRIPED_BLOCK = "tritanium_striped_block"
const val CARBON_FIBRE_BLOCK = "carbon_fibre_block" const val CARBON_FIBRE_BLOCK = "carbon_fibre_block"

View File

@ -4,7 +4,9 @@ import net.minecraft.core.BlockPos
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.damagesource.DamageSource import net.minecraft.world.damagesource.DamageSource
import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.BlockItem
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
import net.minecraft.world.level.BlockGetter import net.minecraft.world.level.BlockGetter
import net.minecraft.world.level.block.* import net.minecraft.world.level.block.*
import net.minecraft.world.level.block.state.BlockBehaviour import net.minecraft.world.level.block.state.BlockBehaviour
@ -12,15 +14,19 @@ import net.minecraft.world.level.block.state.BlockState
import net.minecraft.world.level.material.Material import net.minecraft.world.level.material.Material
import net.minecraft.world.level.material.MaterialColor import net.minecraft.world.level.material.MaterialColor
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext
import net.minecraftforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistry import net.minecraftforge.registries.ForgeRegistry
import net.minecraftforge.registries.IForgeRegistry import net.minecraftforge.registries.IForgeRegistry
import net.minecraftforge.registries.NewRegistryEvent import net.minecraftforge.registries.NewRegistryEvent
import net.minecraftforge.registries.RegistryBuilder import net.minecraftforge.registries.RegistryBuilder
import net.minecraftforge.registries.RegistryObject
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.android.AndroidFeatureType import ru.dbotthepony.mc.otm.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.AndroidResearchType
import java.util.function.Supplier import java.util.function.Supplier
import kotlin.properties.Delegates
import kotlin.properties.ReadOnlyProperty import kotlin.properties.ReadOnlyProperty
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
class CrateProperties(val color: MaterialColor, val name: String) { class CrateProperties(val color: MaterialColor, val name: String) {
@ -85,6 +91,171 @@ private class RegistryDelegate<V>(private val name: String) {
} }
} }
private class WriteOnce<V> : ReadWriteProperty<Any, V> {
private var value: V? = null
override fun getValue(thisRef: Any, property: KProperty<*>): V {
return checkNotNull(value) { "Property wasn't initialized" }
}
override fun setValue(thisRef: Any, property: KProperty<*>, value: V) {
if (this.value != null) {
throw IllegalStateException("Property already initialized")
}
this.value = value
}
}
class ColoredDecorativeBlock(
val baseName: String,
private val propertySupplier: (DyeColor) -> BlockBehaviour.Properties
) {
private var _whiteBlock: RegistryObject<Block> by WriteOnce()
private var _orangeBlock: RegistryObject<Block> by WriteOnce()
private var _magentaBlock: RegistryObject<Block> by WriteOnce()
private var _lightBlueBlock: RegistryObject<Block> by WriteOnce()
private var _yellowBlock: RegistryObject<Block> by WriteOnce()
private var _limeBlock: RegistryObject<Block> by WriteOnce()
private var _pinkBlock: RegistryObject<Block> by WriteOnce()
private var _grayBlock: RegistryObject<Block> by WriteOnce()
private var _lightGrayBlock: RegistryObject<Block> by WriteOnce()
private var _cyanBlock: RegistryObject<Block> by WriteOnce()
private var _purpleBlock: RegistryObject<Block> by WriteOnce()
private var _blueBlock: RegistryObject<Block> by WriteOnce()
private var _brownBlock: RegistryObject<Block> by WriteOnce()
private var _greenBlock: RegistryObject<Block> by WriteOnce()
private var _redBlock: RegistryObject<Block> by WriteOnce()
private var _blackBlock: RegistryObject<Block> by WriteOnce()
val whiteBlock: Block get() = _whiteBlock.get()
val orangeBlock: Block get() = _orangeBlock.get()
val magentaBlock: Block get() = _magentaBlock.get()
val lightBlueBlock: Block get() = _lightBlueBlock.get()
val yellowBlock: Block get() = _yellowBlock.get()
val limeBlock: Block get() = _limeBlock.get()
val pinkBlock: Block get() = _pinkBlock.get()
val grayBlock: Block get() = _grayBlock.get()
val lightGrayBlock: Block get() = _lightGrayBlock.get()
val cyanBlock: Block get() = _cyanBlock.get()
val purpleBlock: Block get() = _purpleBlock.get()
val blueBlock: Block get() = _blueBlock.get()
val brownBlock: Block get() = _brownBlock.get()
val greenBlock: Block get() = _greenBlock.get()
val redBlock: Block get() = _redBlock.get()
val blackBlock: Block get() = _blackBlock.get()
private var _whiteItem: RegistryObject<Item> by WriteOnce()
private var _orangeItem: RegistryObject<Item> by WriteOnce()
private var _magentaItem: RegistryObject<Item> by WriteOnce()
private var _lightBlueItem: RegistryObject<Item> by WriteOnce()
private var _yellowItem: RegistryObject<Item> by WriteOnce()
private var _limeItem: RegistryObject<Item> by WriteOnce()
private var _pinkItem: RegistryObject<Item> by WriteOnce()
private var _grayItem: RegistryObject<Item> by WriteOnce()
private var _lightGrayItem: RegistryObject<Item> by WriteOnce()
private var _cyanItem: RegistryObject<Item> by WriteOnce()
private var _purpleItem: RegistryObject<Item> by WriteOnce()
private var _blueItem: RegistryObject<Item> by WriteOnce()
private var _brownItem: RegistryObject<Item> by WriteOnce()
private var _greenItem: RegistryObject<Item> by WriteOnce()
private var _redItem: RegistryObject<Item> by WriteOnce()
private var _blackItem: RegistryObject<Item> by WriteOnce()
val whiteItem: Item get() = _whiteItem.get()
val orangeItem: Item get() = _orangeItem.get()
val magentaItem: Item get() = _magentaItem.get()
val lightBlueItem: Item get() = _lightBlueItem.get()
val yellowItem: Item get() = _yellowItem.get()
val limeItem: Item get() = _limeItem.get()
val pinkItem: Item get() = _pinkItem.get()
val grayItem: Item get() = _grayItem.get()
val lightGrayItem: Item get() = _lightGrayItem.get()
val cyanItem: Item get() = _cyanItem.get()
val purpleItem: Item get() = _purpleItem.get()
val blueItem: Item get() = _blueItem.get()
val brownItem: Item get() = _brownItem.get()
val greenItem: Item get() = _greenItem.get()
val redItem: Item get() = _redItem.get()
val blackItem: Item get() = _blackItem.get()
val blocks = LazyList(
{ _whiteBlock.get() },
{ _orangeBlock.get() },
{ _magentaBlock.get() },
{ _lightBlueBlock.get() },
{ _yellowBlock.get() },
{ _limeBlock.get() },
{ _pinkBlock.get() },
{ _grayBlock.get() },
{ _lightGrayBlock.get() },
{ _cyanBlock.get() },
{ _purpleBlock.get() },
{ _blueBlock.get() },
{ _brownBlock.get() },
{ _greenBlock.get() },
{ _redBlock.get() },
{ _blackBlock.get() },
)
val items = LazyList(
{ _whiteItem.get() },
{ _orangeItem.get() },
{ _magentaItem.get() },
{ _lightBlueItem.get() },
{ _yellowItem.get() },
{ _limeItem.get() },
{ _pinkItem.get() },
{ _grayItem.get() },
{ _lightGrayItem.get() },
{ _cyanItem.get() },
{ _purpleItem.get() },
{ _blueItem.get() },
{ _brownItem.get() },
{ _greenItem.get() },
{ _redItem.get() },
{ _blackItem.get() },
)
fun registerBlocks(registry: DeferredRegister<Block>) {
_whiteBlock = registry.register("${baseName}_white") { Block(propertySupplier.invoke(DyeColor.WHITE)) }
_orangeBlock = registry.register("${baseName}_orange") { Block(propertySupplier.invoke(DyeColor.ORANGE)) }
_magentaBlock = registry.register("${baseName}_magenta") { Block(propertySupplier.invoke(DyeColor.MAGENTA)) }
_lightBlueBlock = registry.register("${baseName}_light_blue") { Block(propertySupplier.invoke(DyeColor.LIGHT_BLUE)) }
_yellowBlock = registry.register("${baseName}_yellow") { Block(propertySupplier.invoke(DyeColor.YELLOW)) }
_limeBlock = registry.register("${baseName}_lime") { Block(propertySupplier.invoke(DyeColor.LIME)) }
_pinkBlock = registry.register("${baseName}_pink") { Block(propertySupplier.invoke(DyeColor.PINK)) }
_grayBlock = registry.register("${baseName}_gray") { Block(propertySupplier.invoke(DyeColor.GRAY)) }
_lightGrayBlock = registry.register("${baseName}_light_gray") { Block(propertySupplier.invoke(DyeColor.LIGHT_GRAY)) }
_cyanBlock = registry.register("${baseName}_cyan") { Block(propertySupplier.invoke(DyeColor.CYAN)) }
_purpleBlock = registry.register("${baseName}_purple") { Block(propertySupplier.invoke(DyeColor.PURPLE)) }
_blueBlock = registry.register("${baseName}_blue") { Block(propertySupplier.invoke(DyeColor.BLUE)) }
_brownBlock = registry.register("${baseName}_brown") { Block(propertySupplier.invoke(DyeColor.BROWN)) }
_greenBlock = registry.register("${baseName}_green") { Block(propertySupplier.invoke(DyeColor.GREEN)) }
_redBlock = registry.register("${baseName}_red") { Block(propertySupplier.invoke(DyeColor.RED)) }
_blackBlock = registry.register("${baseName}_black") { Block(propertySupplier.invoke(DyeColor.BLACK)) }
}
fun registerItems(registry: DeferredRegister<Item>) {
_whiteItem = registry.register("${baseName}_white") { BlockItem(_whiteBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_orangeItem = registry.register("${baseName}_orange") { BlockItem(_orangeBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_magentaItem = registry.register("${baseName}_magenta") { BlockItem(_magentaBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_lightBlueItem = registry.register("${baseName}_light_blue") { BlockItem(_lightBlueBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_yellowItem = registry.register("${baseName}_yellow") { BlockItem(_yellowBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_limeItem = registry.register("${baseName}_lime") { BlockItem(_limeBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_pinkItem = registry.register("${baseName}_pink") { BlockItem(_pinkBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_grayItem = registry.register("${baseName}_gray") { BlockItem(_grayBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_lightGrayItem = registry.register("${baseName}_light_gray") { BlockItem(_lightGrayBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_cyanItem = registry.register("${baseName}_cyan") { BlockItem(_cyanBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_purpleItem = registry.register("${baseName}_purple") { BlockItem(_purpleBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_blueItem = registry.register("${baseName}_blue") { BlockItem(_blueBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_brownItem = registry.register("${baseName}_brown") { BlockItem(_brownBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_greenItem = registry.register("${baseName}_green") { BlockItem(_greenBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_redItem = registry.register("${baseName}_red") { BlockItem(_redBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
_blackItem = registry.register("${baseName}_black") { BlockItem(_blackBlock.get(), Item.Properties().tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB).stacksTo(64)) }
}
}
object MRegistry { object MRegistry {
private val features = RegistryDelegate<IForgeRegistry<AndroidFeatureType<*>>>("ANDROID_FEATURES") private val features = RegistryDelegate<IForgeRegistry<AndroidFeatureType<*>>>("ANDROID_FEATURES")
private val research = RegistryDelegate<IForgeRegistry<AndroidResearchType<*>>>("ANDROID_RESEARCH") private val research = RegistryDelegate<IForgeRegistry<AndroidResearchType<*>>>("ANDROID_RESEARCH")
@ -92,19 +263,19 @@ object MRegistry {
val ANDROID_FEATURES get() = features.get() as ForgeRegistry<AndroidFeatureType<*>> val ANDROID_FEATURES get() = features.get() as ForgeRegistry<AndroidFeatureType<*>>
val ANDROID_RESEARCH get() = research.get() as ForgeRegistry<AndroidResearchType<*>> val ANDROID_RESEARCH get() = research.get() as ForgeRegistry<AndroidResearchType<*>>
fun initialize(context: FMLJavaModLoadingContext) { val TRITANIUM_BLOCK = ColoredDecorativeBlock(MNames.TRITANIUM_BLOCK) {
context.modEventBus.addListener(this::register) BlockBehaviour.Properties.of(Material.METAL, it.materialColor)
context.modEventBus.register(MStats) .sound(SoundType.BASALT)
context.modEventBus.register(LootModifiers) .requiresCorrectToolForDrops()
.explosionResistance(80f)
.strength(4f)
}
MBlocks.register() val FLOOR_TILES = ColoredDecorativeBlock(MNames.FLOOR_TILES) {
MBlockEntities.register() BlockBehaviour.Properties.of(Material.STONE, it.materialColor)
MEntityTypes.register() .sound(SoundType.STONE)
MMenus.register() .requiresCorrectToolForDrops()
MItems.register() .strength(3f)
AndroidFeatures.register()
AndroidResearch.register()
MSoundEvents.register()
} }
private fun register(event: NewRegistryEvent) { private fun register(event: NewRegistryEvent) {
@ -188,4 +359,19 @@ object MRegistry {
INDUSTRIAL_GLASS_RED, INDUSTRIAL_GLASS_RED,
INDUSTRIAL_GLASS_BLACK, INDUSTRIAL_GLASS_BLACK,
) )
fun initialize(context: FMLJavaModLoadingContext) {
context.modEventBus.addListener(this::register)
context.modEventBus.register(MStats)
context.modEventBus.register(LootModifiers)
MBlocks.register()
MBlockEntities.register()
MEntityTypes.register()
MMenus.register()
MItems.register()
AndroidFeatures.register()
AndroidResearch.register()
MSoundEvents.register()
}
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 565 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B