diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt index f832f8ec0..c38e49530 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DataGen.kt @@ -5,7 +5,9 @@ import net.minecraft.resources.ResourceLocation import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.DoorBlock import net.minecraft.world.level.block.IronBarsBlock +import net.minecraft.world.level.block.SlabBlock import net.minecraft.world.level.block.StairBlock +import net.minecraft.world.level.block.WallBlock import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraft.world.level.block.state.properties.DoorHingeSide import net.minecraft.world.level.block.state.properties.DoubleBlockHalf @@ -111,14 +113,66 @@ object DataGen { } } + const val DECORATIVE_BLOCK_LOCATION = "block/decorative" + fun decorativeStairs(block: StairBlock, side: String, top: String) { blockStateProvider.exec { - blockStateProvider.stairsBlock(block, modLocation("block/decorative/$side"), modLocation("block/decorative/$top"), modLocation("block/decorative/$top")) + blockStateProvider.stairsBlock(block, modLocation("$DECORATIVE_BLOCK_LOCATION/$side"), modLocation("$DECORATIVE_BLOCK_LOCATION/$top"), modLocation("$DECORATIVE_BLOCK_LOCATION/$top")) + } + } + + fun decorativeSlab(block: SlabBlock, base: ResourceLocation, sideTexture: String, topTexture: String) { + blockStateProvider.exec { + blockStateProvider.slabBlock( + block, + base, + modLocation("$DECORATIVE_BLOCK_LOCATION/$sideTexture"), + modLocation("$DECORATIVE_BLOCK_LOCATION/$topTexture"), + modLocation("$DECORATIVE_BLOCK_LOCATION/$topTexture"), + ) } } fun stairs(block: StairBlock) { - stairs(block, "block/decorative/${block.registryName!!.path}", "block/decorative/${block.registryName!!.path}") + stairs(block, "$DECORATIVE_BLOCK_LOCATION/${block.registryName!!.path}", "$DECORATIVE_BLOCK_LOCATION/${block.registryName!!.path}") + } + + fun decorativeWall(block: WallBlock, sideTexture: String, topTexture: String) { + wall(block, "$DECORATIVE_BLOCK_LOCATION/$sideTexture", "$DECORATIVE_BLOCK_LOCATION/$topTexture") + } + + fun wall(block: WallBlock, sideTexture: String, topTexture: String) { + val name = block.registryName?.path ?: throw IllegalStateException("Invalid state of wall block $block") + + var post: ModelFile? = null + var side: ModelFile? = null + var sideTall: ModelFile? = null + + blockModelProvider.exec { + post = blockModelProvider + .withExistingParent(name + "_post", modLocation("block/template_wall_post")) + .texture("wall", modLocation(topTexture)) + .texture("wall_side", modLocation(sideTexture)) + + side = blockModelProvider + .withExistingParent(name + "_side", modLocation("block/template_wall_side")) + .texture("wall", modLocation(topTexture)) + .texture("wall_side", modLocation(sideTexture)) + + sideTall = blockModelProvider + .withExistingParent(name + "_side_tall", modLocation("block/template_wall_side_tall")) + .texture("wall", modLocation(topTexture)) + .texture("wall_side", modLocation(sideTexture)) + } + + blockStateProvider.exec { + blockStateProvider.wallBlock( + block, + checkNotNull(post) { "post model is null" }, + checkNotNull(side) { "side model is null" }, + checkNotNull(sideTall) { "sideTall model is null" }, + ) + } } fun pane(block: Block, textureSide: ResourceLocation, textureRailing: ResourceLocation) { 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 2a3c89bd0..4d4b057f4 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/DecorativeData.kt @@ -1,7 +1,9 @@ package ru.dbotthepony.mc.otm.datagen import net.minecraft.resources.ResourceLocation +import net.minecraft.world.level.block.SlabBlock import net.minecraft.world.level.block.StairBlock +import net.minecraft.world.level.block.WallBlock import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraftforge.client.model.generators.ConfiguredModel import ru.dbotthepony.mc.otm.OverdriveThatMatters @@ -36,10 +38,38 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr DataGen.decorativeStairs(block as StairBlock, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path) } + for ((color, block) in MRegistry.TRITANIUM_SLAB.allBlocks) { + blockStateProvider.exec { + blockStateProvider.slabBlock( + block as SlabBlock, + MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!, + modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/${MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path}") + ) + } + } + + for ((color, block) in MRegistry.TRITANIUM_WALL.allBlocks) { + DataGen.decorativeWall( + block as WallBlock, + sideTexture = MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path, + topTexture = MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path + ) + } + for (item in MRegistry.TRITANIUM_STAIRS.allItems.values) { itemModelProvider.block(item) } + for (item in MRegistry.TRITANIUM_SLAB.allItems.values) { + itemModelProvider.block(item) + } + + for ((color, item) in MRegistry.TRITANIUM_WALL.allItems) { + itemModelProvider.exec { + itemModelProvider.wallInventory(item.registryName!!.path, modLocation(DataGen.DECORATIVE_BLOCK_LOCATION + "/" + MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path)) + } + } + DataGen.decoratives(MRegistry.FLOOR_TILES) DataGen.decoratives(MRegistry.UNREFINED_FLOOR_TILES) DataGen.decoratives(MRegistry.VENT) @@ -64,10 +94,39 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr ) } + for ((block, colors) in MRegistry.TRITANIUM_STRIPED_SLAB.blocksWithColor) { + DataGen.decorativeSlab( + block as SlabBlock, + MRegistry.TRITANIUM_STRIPED_BLOCK.getBlock(colors.first, colors.second).registryName!!, + "stripe/${MRegistry.TRITANIUM_STRIPED_BLOCK.getBlock(colors.first, colors.second).registryName!!.path}", + "tritanium_block_${colors.first.name.lowercase()}" + ) + } + + for ((block, colors) in MRegistry.TRITANIUM_STRIPED_WALL.blocksWithColor) { + DataGen.decorativeWall( + block as WallBlock, + sideTexture = "stripe/${MRegistry.TRITANIUM_STRIPED_BLOCK.getBlock(colors.first, colors.second).registryName!!.path}", + topTexture = "tritanium_block_${colors.first.name.lowercase()}" + ) + } + for (item in MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems) { itemModelProvider.block(item) } + for (item in MRegistry.TRITANIUM_STRIPED_SLAB.flatItems) { + itemModelProvider.block(item) + } + + for ((item, colors) in MRegistry.TRITANIUM_STRIPED_WALL.itemsWithColor) { + itemModelProvider.exec { + itemModelProvider.withExistingParent(item.registryName!!.path, modLocation("block/wall_inventory")) + .texture("wall_side", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/stripe/${MRegistry.TRITANIUM_STRIPED_BLOCK.getBlock(colors.first, colors.second).registryName!!.path}")) + .texture("wall", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_block_${colors.first.name.lowercase()}")) + } + } + DataGen.decorativeCubeAll(MBlocks.DANGER_STRIPE_BLOCK) DataGen.decorativeColumn(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top") @@ -135,7 +194,16 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr DataGen.decorativeColumn(MBlocks.TRITANIUM_STRIPED_BLOCK, "tritanium_striped_block", "tritanium_block") DataGen.decorativeStairs(MBlocks.TRITANIUM_STRIPED_STAIRS as StairBlock, "tritanium_striped_block", "tritanium_block") + DataGen.decorativeWall(MBlocks.TRITANIUM_STRIPED_WALL as WallBlock, "tritanium_striped_block", "tritanium_block") + DataGen.decorativeSlab(MBlocks.TRITANIUM_STRIPED_SLAB as SlabBlock, MBlocks.TRITANIUM_STRIPED_BLOCK.registryName!!, "tritanium_striped_block", "tritanium_block") itemModelProvider.block(MItems.TRITANIUM_STRIPED_STAIRS) + itemModelProvider.block(MItems.TRITANIUM_STRIPED_SLAB) + + itemModelProvider.exec { + itemModelProvider.withExistingParent(MItems.TRITANIUM_STRIPED_WALL.registryName!!.path, modLocation("block/wall_inventory")) + .texture("wall_side", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_striped_block")) + .texture("wall", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_block")) + } for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks) { val name = MRegistry.INDUSTRIAL_GLASS.allBlocks[color]!!.registryName!!.path diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt index 54d2b6b21..2983c0901 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/lang/English.kt @@ -8,6 +8,8 @@ private fun decoratives(provider: MatteryLanguageProvider) { provider.englishColors.add(MRegistry.TRITANIUM_BLOCK, "%s Tritanium Block") provider.englishColors.add(MRegistry.TRITANIUM_STAIRS, "%s Tritanium Stairs") + provider.englishColors.add(MRegistry.TRITANIUM_SLAB, "%s Tritanium Slab") + provider.englishColors.add(MRegistry.TRITANIUM_WALL, "%s Tritanium Wall") provider.englishColors.add(MRegistry.FLOOR_TILES, "%s Floor Tiles") provider.englishColors.add(MRegistry.UNREFINED_FLOOR_TILES, "Unrefined %s Floor Tiles") @@ -29,6 +31,8 @@ private fun decoratives(provider: MatteryLanguageProvider) { add(MRegistry.CARGO_CRATES.block, "Cargo Crate") add(MRegistry.TRITANIUM_BLOCK.block, "Tritanium Block") add(MRegistry.TRITANIUM_STAIRS.block, "Tritanium Stairs") + add(MRegistry.TRITANIUM_SLAB.block, "Tritanium Slab") + add(MRegistry.TRITANIUM_WALL.block, "Tritanium Wall") add(MRegistry.INDUSTRIAL_GLASS.block, "Industrial Glass") add(MRegistry.INDUSTRIAL_GLASS_PANE.block, "Industrial Glass Pane") @@ -55,6 +59,24 @@ private fun decoratives(provider: MatteryLanguageProvider) { add(block, "$baseName Colored $stripeName Striped Tritanium Stairs") } + + for ((block, colors) in MRegistry.TRITANIUM_STRIPED_SLAB.blocksWithColor) { + val (base, stripe) = colors + + val baseName = provider.englishColors.dyeClassMapped[base]!! + val stripeName = provider.englishColors.dyeClassMapped[stripe]!! + + add(block, "$baseName Colored $stripeName Striped Tritanium Slab") + } + + for ((block, colors) in MRegistry.TRITANIUM_STRIPED_WALL.blocksWithColor) { + val (base, stripe) = colors + + val baseName = provider.englishColors.dyeClassMapped[base]!! + val stripeName = provider.englishColors.dyeClassMapped[stripe]!! + + add(block, "$baseName Colored $stripeName Striped Tritanium Wall") + } } } @@ -339,6 +361,8 @@ private fun blocks(provider: MatteryLanguageProvider) { add(MBlocks.TRITANIUM_STRIPED_BLOCK, "Tritanium Striped Block") add(MBlocks.TRITANIUM_STRIPED_STAIRS, "Tritanium Striped Stairs") + add(MBlocks.TRITANIUM_STRIPED_SLAB, "Tritanium Striped Slab") + add(MBlocks.TRITANIUM_STRIPED_WALL, "Tritanium Striped Wall") add(MBlocks.TRITANIUM_ORE, "Tritanium Ore") add(MBlocks.DEEPSLATE_TRITANIUM_ORE, "Deepslate Tritanium Ore") add(MBlocks.TRITANIUM_RAW_BLOCK, "Raw Tritanium Block") diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTables.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTables.kt index d77578c5f..5b0f9aa84 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTables.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTables.kt @@ -2,22 +2,29 @@ package ru.dbotthepony.mc.otm.datagen.loot import com.mojang.datafixers.util.Pair import it.unimi.dsi.fastutil.objects.ObjectArraySet +import net.minecraft.advancements.critereon.StatePropertiesPredicate import net.minecraft.data.DataGenerator +import net.minecraft.data.loot.BlockLoot import net.minecraft.data.loot.LootTableProvider import net.minecraft.resources.ResourceLocation import net.minecraft.world.level.ItemLike import net.minecraft.world.level.block.Block +import net.minecraft.world.level.block.SlabBlock +import net.minecraft.world.level.block.state.properties.SlabType import net.minecraft.world.level.storage.loot.LootPool import net.minecraft.world.level.storage.loot.LootTable import net.minecraft.world.level.storage.loot.ValidationContext import net.minecraft.world.level.storage.loot.entries.LootItem import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction +import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets +import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition import net.minecraft.world.level.storage.loot.providers.nbt.ContextNbtProvider +import net.minecraft.world.level.storage.loot.providers.number.ConstantValue import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity -import java.util.LinkedList +import java.util.* import java.util.function.BiConsumer import java.util.function.Consumer import java.util.function.Supplier @@ -72,6 +79,29 @@ class LootTables(generator: DataGenerator) : LootTableProvider(generator) { providers.add(Pair(Supplier { provider }, LootContextParamSets.BLOCK)) } + fun createSlabItemTable(block: Block) { + provider(LootContextParamSets.BLOCK) { + it.accept(block.lootTable, LootTable.lootTable().withPool( + LootPool.lootPool().setRolls(ConstantValue.exactly(1.0f)).add( + LootItem.lootTableItem(block).apply( + SetItemCountFunction.setCount( + ConstantValue.exactly(2.0f) + ).`when`( + LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties( + StatePropertiesPredicate.Builder.properties() + .hasProperty(SlabBlock.TYPE, SlabType.DOUBLE) + ) + ) + ) + ) + )) + } + } + + fun createSlabItemTable(block: Collection) { + block.forEach(this::createSlabItemTable) + } + fun blockSimple(block: Block, provider: (LootPool.Builder) -> Unit) { block { it.accept(block.lootTable, singleLootPool(provider::invoke)) diff --git a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt index d666f933c..fd7cf89e4 100644 --- a/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt +++ b/src/data/kotlin/ru/dbotthepony/mc/otm/datagen/loot/LootTablesData.kt @@ -33,17 +33,24 @@ fun addLootTables(lootTables: LootTables) { lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values) lootTables.dropsSelf(MRegistry.TRITANIUM_BLOCK.allBlocks.values) + lootTables.dropsSelf(MRegistry.TRITANIUM_WALL.allBlocks.values) lootTables.dropsSelf(MRegistry.TRITANIUM_STAIRS.allBlocks.values) + lootTables.createSlabItemTable(MRegistry.TRITANIUM_SLAB.allBlocks.values) lootTables.dropsSelf(MRegistry.VENT.allBlocks.values) lootTables.dropsSelf(MRegistry.VENT_ALTERNATIVE.allBlocks.values) lootTables.dropsSelf(MRegistry.FLOOR_TILES.blocks.values) lootTables.dropsSelf(MRegistry.UNREFINED_FLOOR_TILES.blocks.values) lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_BLOCK.flatBlocks) lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks) + lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks) + lootTables.createSlabItemTable(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks) lootTables.dropsSelf(MBlocks.CARBON_FIBRE_BLOCK) lootTables.dropsSelf(MBlocks.TRITANIUM_RAW_BLOCK) lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_BLOCK) + lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_WALL) + lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_STAIRS) + lootTables.createSlabItemTable(MBlocks.TRITANIUM_STRIPED_SLAB) lootTables.dropsSelf(MBlocks.MATTER_CABLE) lootTables.dropsSelf(MBlocks.GRAVITATION_STABILIZER) lootTables.dropsOther(MBlocks.GRAVITATION_STABILIZER_LENS, MBlocks.GRAVITATION_STABILIZER) 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 489d7ce09..33e701aa1 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 @@ -27,6 +27,21 @@ private fun stairs(base: ItemLike, result: ItemLike, consumer: Consumer) { + MatteryRecipe(result, 6) + .row(base, base, base) + .unlockedBy(base) + .build(consumer) +} + +private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer) { + MatteryRecipe(result, 6) + .row(base, base, base) + .row(base, base, base) + .unlockedBy(base) + .build(consumer) +} + fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer) { // Напольная плитка for ((color, unrefinedItem) in MRegistry.UNREFINED_FLOOR_TILES.items) { @@ -49,14 +64,20 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer { - fun add(value: T): TagsProvider + fun add(value: T): MTagAppender fun addSafe(value: T): Boolean - fun add(vararg values: T): TagsProvider + fun add(vararg values: T): MTagAppender fun addSafe(vararg values: T): Boolean { var any = false for (value in values) any = addSafe(value) return any } - fun add(values: Collection): TagsProvider - fun add(values: Stream): TagsProvider = add(values.toList()) + fun add(values: Collection): MTagAppender + fun add(values: Stream): MTagAppender = add(values.toList()) fun addSafe(values: Collection): Boolean { var any = false @@ -37,16 +37,16 @@ interface MTagAppender { } interface ForgeTagAppender : MTagAppender { - fun add(key: String, value: T): TagsProvider + fun add(key: String, value: T): MTagAppender fun addSafe(key: String, value: T): Boolean - fun add(key: String, vararg values: T): TagsProvider + fun add(key: String, vararg values: T): MTagAppender fun addSafe(key: String, vararg values: T): Boolean { var any = false for (value in values) any = addSafe(key, value) return any } - fun add(key: String, values: Collection): TagsProvider + fun add(key: String, values: Collection): MTagAppender fun addSafe(key: String, values: Collection): Boolean { var any = false @@ -89,26 +89,26 @@ class TagsProvider( val list = getSet(tag) return object : MTagAppender { - override fun add(value: T): TagsProvider { + override fun add(value: T): MTagAppender { if (!list.add(value)) { throw IllegalStateException(message.invoke(value).toString()) } - return this@TagsProvider + return this } - override fun add(values: Collection): TagsProvider { + override fun add(values: Collection): MTagAppender { for (value in values) add(value) - return this@TagsProvider + return this } override fun addSafe(value: T): Boolean { return list.add(value) } - override fun add(vararg values: T): TagsProvider { + override fun add(vararg values: T): MTagAppender { values.forEach(this::add) - return this@TagsProvider + return this } } } @@ -117,14 +117,14 @@ class TagsProvider( val parent by lazy { appender(ResourceLocation("forge", path)) } return object : ForgeTagAppender { - override fun add(key: String, value: T): TagsProvider { + override fun add(key: String, value: T): MTagAppender { val tag = TagKey.create(registry.key(), ResourceLocation("forge", "$path/$key")) if (!getSet(tag).add(value)) { throw IllegalStateException("$value is already in $tag") } - return this@TagsProvider + return this } override fun addSafe(key: String, value: T): Boolean { @@ -132,17 +132,17 @@ class TagsProvider( return getSet(tag).add(value) } - override fun add(key: String, vararg values: T): TagsProvider { + override fun add(key: String, vararg values: T): MTagAppender { for (value in values) add(key, value) - return this@TagsProvider + return this } - override fun add(key: String, values: Collection): TagsProvider { + override fun add(key: String, values: Collection): MTagAppender { for (value in values) add(key, value) - return this@TagsProvider + return this } - override fun add(value: T): TagsProvider { + override fun add(value: T): MTagAppender { return parent.add(value) } @@ -150,11 +150,11 @@ class TagsProvider( return parent.addSafe(value) } - override fun add(vararg values: T): TagsProvider { + override fun add(vararg values: T): MTagAppender { return parent.add(*values) } - override fun add(values: Collection): TagsProvider { + override fun add(values: Collection): MTagAppender { return parent.add(values) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt index 5b5c67d4f..07f1bcd44 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MBlocks.kt @@ -10,9 +10,11 @@ import net.minecraft.world.level.BlockGetter import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.DoorBlock import net.minecraft.world.level.block.DropExperienceBlock +import net.minecraft.world.level.block.SlabBlock import net.minecraft.world.level.block.SoundType import net.minecraft.world.level.block.StairBlock import net.minecraft.world.level.block.TrapDoorBlock +import net.minecraft.world.level.block.WallBlock import net.minecraft.world.level.block.state.BlockBehaviour import net.minecraft.world.level.material.Material import net.minecraft.world.level.material.MaterialColor @@ -160,6 +162,8 @@ object MBlocks { MRegistry.CARGO_CRATES.registerBlocks(registry) MRegistry.TRITANIUM_BLOCK.registerBlocks(registry) MRegistry.TRITANIUM_STAIRS.registerBlocks(registry) + MRegistry.TRITANIUM_SLAB.registerBlocks(registry) + MRegistry.TRITANIUM_WALL.registerBlocks(registry) } val TRITANIUM_STRIPED_BLOCK: Block by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { Block( @@ -172,13 +176,17 @@ object MBlocks { val TRITANIUM_STRIPED_STAIRS: Block by registry.register(MNames.TRITANIUM_STRIPED_STAIRS) { StairBlock( { TRITANIUM_STRIPED_BLOCK.defaultBlockState() }, - BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE) - .sound(SoundType.BASALT) - .requiresCorrectToolForDrops() - .explosionResistance(80f) - .strength(4f) + BlockBehaviour.Properties.copy(TRITANIUM_STRIPED_BLOCK) ) } + val TRITANIUM_STRIPED_SLAB: Block by registry.register(MNames.TRITANIUM_STRIPED_SLAB) { + SlabBlock(BlockBehaviour.Properties.copy(TRITANIUM_STRIPED_BLOCK)) + } + + val TRITANIUM_STRIPED_WALL: Block by registry.register(MNames.TRITANIUM_STRIPED_WALL) { + WallBlock(BlockBehaviour.Properties.copy(TRITANIUM_STRIPED_BLOCK)) + } + val CARBON_FIBRE_BLOCK: Block by registry.register(MNames.CARBON_FIBRE_BLOCK) { Block( BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_LIGHT_BLUE) .sound(SoundType.BASALT) @@ -197,5 +205,7 @@ object MBlocks { MRegistry.DECORATIVE_CRATE.registerBlocks(registry) MRegistry.TRITANIUM_STRIPED_BLOCK.registerBlocks(registry) MRegistry.TRITANIUM_STRIPED_STAIRS.registerBlocks(registry) + MRegistry.TRITANIUM_STRIPED_SLAB.registerBlocks(registry) + MRegistry.TRITANIUM_STRIPED_WALL.registerBlocks(registry) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt index 4c71f1ee6..4e7278af8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MItems.kt @@ -333,10 +333,14 @@ object MItems { MRegistry.CARGO_CRATES.registerItems(registry) MRegistry.TRITANIUM_BLOCK.registerItems(registry) MRegistry.TRITANIUM_STAIRS.registerItems(registry) + MRegistry.TRITANIUM_SLAB.registerItems(registry) + MRegistry.TRITANIUM_WALL.registerItems(registry) } val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) } val TRITANIUM_STRIPED_STAIRS: Item by registry.register(MNames.TRITANIUM_STRIPED_STAIRS) { BlockItem(MBlocks.TRITANIUM_STRIPED_STAIRS, DEFAULT_PROPERTIES_DECORATIVE) } + val TRITANIUM_STRIPED_SLAB: Item by registry.register(MNames.TRITANIUM_STRIPED_SLAB) { BlockItem(MBlocks.TRITANIUM_STRIPED_SLAB, DEFAULT_PROPERTIES_DECORATIVE) } + val TRITANIUM_STRIPED_WALL: Item by registry.register(MNames.TRITANIUM_STRIPED_WALL) { BlockItem(MBlocks.TRITANIUM_STRIPED_WALL, DEFAULT_PROPERTIES_DECORATIVE) } val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) } init { @@ -349,5 +353,7 @@ object MItems { MRegistry.DECORATIVE_CRATE.registerItems(registry) MRegistry.TRITANIUM_STRIPED_BLOCK.registerItems(registry) MRegistry.TRITANIUM_STRIPED_STAIRS.registerItems(registry) + MRegistry.TRITANIUM_STRIPED_SLAB.registerItems(registry) + MRegistry.TRITANIUM_STRIPED_WALL.registerItems(registry) } } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt index b141fa459..44e88196d 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MNames.kt @@ -52,8 +52,12 @@ object MNames { // building blocks const val TRITANIUM_BLOCK = "tritanium_block" const val TRITANIUM_STAIRS = "tritanium_stairs" + const val TRITANIUM_SLAB = "tritanium_slab" + const val TRITANIUM_WALL = "tritanium_wall" const val TRITANIUM_STRIPED_BLOCK = "tritanium_striped_block" const val TRITANIUM_STRIPED_STAIRS = "tritanium_striped_stairs" + const val TRITANIUM_STRIPED_SLAB = "tritanium_striped_slab" + const val TRITANIUM_STRIPED_WALL = "tritanium_striped_wall" const val INDUSTRIAL_GLASS = "industrial_glass" const val INDUSTRIAL_GLASS_PANE = "industrial_glass_pane" diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt index 4f377793b..903d07f2e 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/MRegistry.kt @@ -138,14 +138,18 @@ object MRegistry { val TRITANIUM_STAIRS = DecorativeBlock(MNames.TRITANIUM_STAIRS, { StairBlock( { TRITANIUM_BLOCK.allBlocks[it]!!.defaultBlockState() }, - BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE) - .sound(SoundType.BASALT) - .requiresCorrectToolForDrops() - .explosionResistance(80f) - .destroyTime(2.5f) + BlockBehaviour.Properties.copy(TRITANIUM_BLOCK.allBlocks[it]!!) ) }) + val TRITANIUM_SLAB = DecorativeBlock(MNames.TRITANIUM_SLAB, { + SlabBlock(BlockBehaviour.Properties.copy(TRITANIUM_BLOCK.allBlocks[it]!!)) + }) + + val TRITANIUM_WALL = DecorativeBlock(MNames.TRITANIUM_WALL, { + WallBlock(BlockBehaviour.Properties.copy(TRITANIUM_BLOCK.allBlocks[it]!!)) + }) + val VENT = DecorativeBlock.simple(MNames.VENT, { BlockBehaviour.Properties.of(Material.METAL, it?.materialColor ?: MaterialColor.COLOR_LIGHT_BLUE) .sound(SoundType.BASALT) @@ -251,11 +255,15 @@ object MRegistry { }) val TRITANIUM_STRIPED_STAIRS = StripedColoredDecorativeBlock(MNames.TRITANIUM_STRIPED_STAIRS, { colorA, colorB -> - StairBlock({ TRITANIUM_STRIPED_BLOCK.getBlock(colorA, colorB).defaultBlockState() }, BlockBehaviour.Properties.of(Material.METAL, colorA.materialColor) - .sound(SoundType.BASALT) - .requiresCorrectToolForDrops() - .explosionResistance(80f) - .strength(4f)) + StairBlock({ TRITANIUM_STRIPED_BLOCK.getBlock(colorA, colorB).defaultBlockState() }, BlockBehaviour.Properties.copy(TRITANIUM_STRIPED_BLOCK.getBlock(colorA, colorB))) + }) + + val TRITANIUM_STRIPED_SLAB = StripedColoredDecorativeBlock(MNames.TRITANIUM_STRIPED_SLAB, { colorA, colorB -> + SlabBlock(BlockBehaviour.Properties.copy(TRITANIUM_STRIPED_BLOCK.getBlock(colorA, colorB))) + }) + + val TRITANIUM_STRIPED_WALL = StripedColoredDecorativeBlock(MNames.TRITANIUM_STRIPED_WALL, { colorA, colorB -> + WallBlock(BlockBehaviour.Properties.copy(TRITANIUM_STRIPED_BLOCK.getBlock(colorA, colorB))) }) fun initialize(bus: IEventBus) { diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/objects/StripedColoredDecorativeBlock.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/objects/StripedColoredDecorativeBlock.kt index e7a2259b3..7c55341df 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/registry/objects/StripedColoredDecorativeBlock.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/registry/objects/StripedColoredDecorativeBlock.kt @@ -90,7 +90,7 @@ class StripedColoredDecorativeBlock( } mapItems.computeIfAbsent(base) { EnumMap(DyeColor::class.java) } - .put(stripe, registry.register("${basename}_${base.name.lowercase()}_${stripe.name.lowercase()}") { itemFactory.invoke(base, stripe, mapBlocks.get(base)!!.get(stripe)!!.get()) }) + .put(stripe, registry.register("${basename}_${base.name.lowercase()}_${stripe.name.lowercase()}".intern()) { itemFactory.invoke(base, stripe, mapBlocks.get(base)!!.get(stripe)!!.get()) }) } } @@ -105,7 +105,7 @@ class StripedColoredDecorativeBlock( } mapBlocks.computeIfAbsent(base) { EnumMap(DyeColor::class.java) } - .put(stripe, registry.register("${basename}_${base.name.lowercase()}_${stripe.name.lowercase()}") { blockFactory.invoke(base, stripe) }) + .put(stripe, registry.register("${basename}_${base.name.lowercase()}_${stripe.name.lowercase()}".intern()) { blockFactory.invoke(base, stripe) }) } } diff --git a/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_post.json b/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_post.json new file mode 100644 index 000000000..c742001b6 --- /dev/null +++ b/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_post.json @@ -0,0 +1,19 @@ +{ + "textures": { + "particle": "#wall" + }, + "elements": [ + { "from": [ 4, 0, 4 ], + "to": [ 12, 16, 12 ], + "faces": { + "down": { "texture": "#wall", "cullface": "down" }, + "up": { "texture": "#wall", "cullface": "up" }, + "north": { "texture": "#wall_side" }, + "south": { "texture": "#wall_side" }, + "west": { "texture": "#wall_side" }, + "east": { "texture": "#wall_side" } + }, + "__comment": "Center post" + } + ] +} diff --git a/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_side.json b/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_side.json new file mode 100644 index 000000000..50e6d769e --- /dev/null +++ b/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_side.json @@ -0,0 +1,18 @@ +{ + "textures": { + "particle": "#wall" + }, + "elements": [ + { "from": [ 5, 0, 0 ], + "to": [ 11, 14, 8 ], + "faces": { + "down": { "texture": "#wall", "cullface": "down" }, + "up": { "texture": "#wall" }, + "north": { "texture": "#wall_side", "cullface": "north" }, + "west": { "texture": "#wall_side" }, + "east": { "texture": "#wall_side" } + }, + "__comment": "wall" + } + ] +} diff --git a/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_side_tall.json b/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_side_tall.json new file mode 100644 index 000000000..c0bf08b46 --- /dev/null +++ b/src/main/resources/assets/overdrive_that_matters/models/block/template_wall_side_tall.json @@ -0,0 +1,17 @@ +{ + "textures": { + "particle": "#wall" + }, + "elements": [ + { "from": [ 5, 0, 0 ], + "to": [ 11, 16, 8 ], + "faces": { + "down": { "texture": "#wall", "cullface": "down" }, + "up": { "texture": "#wall", "cullface": "up"}, + "north": { "texture": "#wall_side", "cullface": "north" }, + "west": { "texture": "#wall_side" }, + "east": { "texture": "#wall_side" } + } + } + ] +} diff --git a/src/main/resources/assets/overdrive_that_matters/models/block/wall_inventory.json b/src/main/resources/assets/overdrive_that_matters/models/block/wall_inventory.json new file mode 100644 index 000000000..1a7769986 --- /dev/null +++ b/src/main/resources/assets/overdrive_that_matters/models/block/wall_inventory.json @@ -0,0 +1,44 @@ +{ "parent": "block/block", + "display": { + "gui": { + "rotation": [ 30, 135, 0 ], + "translation": [ 0, 0, 0], + "scale":[ 0.625, 0.625, 0.625 ] + }, + "fixed": { + "rotation": [ 0, 90, 0 ], + "translation": [ 0, 0, 0 ], + "scale": [ 0.5, 0.5, 0.5 ] + } + }, + "ambientocclusion": false, + "textures": { + "particle": "#wall" + }, + "elements": [ + { "from": [ 4, 0, 4 ], + "to": [ 12, 16, 12 ], + "faces": { + "down": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall", "cullface": "down" }, + "up": { "uv": [ 4, 4, 12, 12 ], "texture": "#wall" }, + "north": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall_side" }, + "south": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall_side" }, + "west": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall_side" }, + "east": { "uv": [ 4, 0, 12, 16 ], "texture": "#wall_side" } + }, + "__comment": "Center post" + }, + { "from": [ 5, 0, 0 ], + "to": [ 11, 13, 16 ], + "faces": { + "down": { "uv": [ 5, 0, 11, 16 ], "texture": "#wall", "cullface": "down" }, + "up": { "uv": [ 5, 0, 11, 16 ], "texture": "#wall" }, + "north": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall_side", "cullface": "north" }, + "south": { "uv": [ 5, 3, 11, 16 ], "texture": "#wall_side", "cullface": "south" }, + "west": { "uv": [ 0, 3, 16, 16 ], "texture": "#wall_side" }, + "east": { "uv": [ 0, 3, 16, 16 ], "texture": "#wall_side" } + }, + "__comment": "Full wall" + } + ] +}