Striped tritanium blocks recipes

This commit is contained in:
DBotThePony 2022-08-28 15:53:15 +07:00
parent 56d5277988
commit 6d407d4c59
Signed by: DBot
GPG Key ID: DCC23B5715498507
9 changed files with 3097 additions and 119 deletions

View File

@ -5,7 +5,6 @@ import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.IronBarsBlock import net.minecraft.world.level.block.IronBarsBlock
import net.minecraftforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
@ -35,7 +34,6 @@ 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.* import ru.dbotthepony.mc.otm.registry.*
import ru.dbotthepony.mc.otm.* import ru.dbotthepony.mc.otm.*
import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipe
import ru.dbotthepony.mc.otm.datagen.recipes.addCraftingTableRecipes import ru.dbotthepony.mc.otm.datagen.recipes.addCraftingTableRecipes
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock
@ -176,8 +174,8 @@ object DataGen {
decorativeCubeAll(glass) decorativeCubeAll(glass)
} }
for ((i, block) in MBlocks.TRITANIUM_STRIPED_BLOCKS.withIndex()) { for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) {
decorativeColumn(block, "stripe/${block.registryName!!.path}", "tritanium_block_${MBlocks.TRITANIUM_STRIPED_BLOCKS_COLORS[i]}") decorativeColumn(block, "stripe/${block.registryName!!.path}", "tritanium_block_${colors.first.name.lowercase()}")
} }
blockModelProvider.resourceCubeAll(MBlocks.TRITANIUM_ORE) blockModelProvider.resourceCubeAll(MBlocks.TRITANIUM_ORE)
@ -383,7 +381,7 @@ object DataGen {
MRegistry.TRITANIUM_BLOCK.items.forEach(this::block) MRegistry.TRITANIUM_BLOCK.items.forEach(this::block)
MRegistry.INDUSTRIAL_GLASS.items.forEach(this::block) MRegistry.INDUSTRIAL_GLASS.items.forEach(this::block)
for (block in MItems.TRITANIUM_STRIPED_BLOCKS) { for (block in MRegistry.TRITANIUM_STRIPED_BLOCK.items) {
block(block) block(block)
} }

View File

@ -8,6 +8,7 @@ import net.minecraft.network.chat.MutableComponent
import net.minecraft.network.chat.contents.TranslatableContents import net.minecraft.network.chat.contents.TranslatableContents
import net.minecraft.world.effect.MobEffect import net.minecraft.world.effect.MobEffect
import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.enchantment.Enchantment import net.minecraft.world.item.enchantment.Enchantment
@ -173,6 +174,44 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
.build() .build()
val dyeClassMapped: Map<DyeColor, String> = ImmutableMap.builder<DyeColor, String>()
.put(DyeColor.WHITE, white)
.put(DyeColor.ORANGE, orange)
.put(DyeColor.MAGENTA, magenta)
.put(DyeColor.LIGHT_BLUE, lightBlue)
.put(DyeColor.YELLOW, yellow)
.put(DyeColor.LIME, lime)
.put(DyeColor.PINK, pink)
.put(DyeColor.GRAY, gray)
.put(DyeColor.LIGHT_GRAY, lightGray)
.put(DyeColor.CYAN, cyan)
.put(DyeColor.PURPLE, purple)
.put(DyeColor.BLUE, blue)
.put(DyeColor.BROWN, brown)
.put(DyeColor.GREEN, green)
.put(DyeColor.RED, red)
.put(DyeColor.BLACK, black)
.build()
val dyeClassPairs: List<Pair<DyeColor, String>> = ImmutableList.builder<Pair<DyeColor, String>>()
.add(DyeColor.WHITE to white)
.add(DyeColor.ORANGE to orange)
.add(DyeColor.MAGENTA to magenta)
.add(DyeColor.LIGHT_BLUE to lightBlue)
.add(DyeColor.YELLOW to yellow)
.add(DyeColor.LIME to lime)
.add(DyeColor.PINK to pink)
.add(DyeColor.GRAY to gray)
.add(DyeColor.LIGHT_GRAY to lightGray)
.add(DyeColor.CYAN to cyan)
.add(DyeColor.PURPLE to purple)
.add(DyeColor.BLUE to blue)
.add(DyeColor.BROWN to brown)
.add(DyeColor.GREEN to green)
.add(DyeColor.RED to red)
.add(DyeColor.BLACK to black)
.build()
fun add(list: ColoredDecorativeBlock, toFormat: String) { fun add(list: ColoredDecorativeBlock, toFormat: String) {
slave.add(list.whiteBlock, toFormat.format(white)) slave.add(list.whiteBlock, toFormat.format(white))
slave.add(list.orangeBlock, toFormat.format(orange)) slave.add(list.orangeBlock, toFormat.format(orange))

View File

@ -25,17 +25,13 @@ private fun decoratives(provider: MatteryLanguageProvider) {
add(MRegistry.VENT.block, "Vent") add(MRegistry.VENT.block, "Vent")
add(MRegistry.VENT_ALTERNATIVE.block, "Alternative Vent") add(MRegistry.VENT_ALTERNATIVE.block, "Alternative Vent")
var i = 0 for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) {
val (base, stripe) = colors
for ((colorBase, baseName) in provider.englishColors.pairList) { val baseName = provider.englishColors.dyeClassMapped[base]!!
for ((colorStrip, stripName) in provider.englishColors.pairList) { val stripeName = provider.englishColors.dyeClassMapped[stripe]!!
if (colorBase == colorStrip) {
continue
}
val block = MBlocks.TRITANIUM_STRIPED_BLOCKS[i++] add(block, "$baseName Colored $stripeName Striped Tritanium Block")
add(block, "$baseName Colored $stripName Striped Tritanium Block")
}
} }
} }
} }

View File

@ -11,6 +11,7 @@ import net.minecraft.world.item.crafting.Ingredient
import net.minecraftforge.common.Tags import net.minecraftforge.common.Tags
import net.minecraftforge.common.Tags.Items.COBBLESTONE import net.minecraftforge.common.Tags.Items.COBBLESTONE
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
@ -54,6 +55,62 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.build(consumer) .build(consumer)
} }
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24)
.rowB(MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.rowAB(Tags.Items.DYES_YELLOW, MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.unlockedBy(Tags.Items.DYES_YELLOW)
.build(consumer)
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24)
.rowB(MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.rowBC(MItemTags.PLATE_TRITANIUM, Tags.Items.DYES_YELLOW)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.unlockedBy(Tags.Items.DYES_YELLOW)
.build(consumer, "alt")
for ((item, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.itemsWithColor) {
val (base, stripe) = colors
MatteryRecipe(item, 24)
.rowAB(a = base.tag, b = MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.rowAB(a = stripe.tag, b = MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.unlockedBy(base.tag)
.unlockedBy(stripe.tag)
.build(consumer, "1")
MatteryRecipe(item, 24)
.rowBC(c = base.tag, b = MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.rowBC(c = stripe.tag, b = MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.unlockedBy(base.tag)
.unlockedBy(stripe.tag)
.build(consumer, "2")
MatteryRecipe(item, 24)
.rowAB(a = base.tag, b = MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.rowBC(c = stripe.tag, b = MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.unlockedBy(base.tag)
.unlockedBy(stripe.tag)
.build(consumer, "3")
MatteryRecipe(item, 24)
.rowBC(c = base.tag, b = MItemTags.PLATE_TRITANIUM)
.row(MItemTags.PLATE_TRITANIUM, COBBLESTONE, MItemTags.PLATE_TRITANIUM)
.rowAB(a = stripe.tag, b = MItemTags.PLATE_TRITANIUM)
.unlockedBy(MItemTags.PLATE_TRITANIUM)
.unlockedBy(base.tag)
.unlockedBy(stripe.tag)
.build(consumer, "4")
}
for ((color, item) in MRegistry.VENT.mappedColoredItemsAll) { for ((color, item) in MRegistry.VENT.mappedColoredItemsAll) {
MatteryRecipe(item, 24) MatteryRecipe(item, 24)
.rowAB(color?.tag, MItemTags.PLATE_TRITANIUM) .rowAB(color?.tag, MItemTags.PLATE_TRITANIUM)
@ -85,7 +142,7 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.rowB(MItemTags.PLATE_IRON) .rowB(MItemTags.PLATE_IRON)
.unlockedBy(MItemTags.PLATE_IRON) .unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color) .unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_1") .build(consumer, "1")
MatteryRecipe(crate, 24) MatteryRecipe(crate, 24)
.rowBC(MItemTags.PLATE_IRON, color) .rowBC(MItemTags.PLATE_IRON, color)
@ -93,7 +150,7 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.rowB(MItemTags.PLATE_IRON) .rowB(MItemTags.PLATE_IRON)
.unlockedBy(MItemTags.PLATE_IRON) .unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color) .unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_2") .build(consumer, "2")
MatteryRecipe(crate, 24) MatteryRecipe(crate, 24)
.rowB(MItemTags.PLATE_IRON) .rowB(MItemTags.PLATE_IRON)
@ -101,7 +158,7 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.rowAB(color, MItemTags.PLATE_IRON) .rowAB(color, MItemTags.PLATE_IRON)
.unlockedBy(MItemTags.PLATE_IRON) .unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color) .unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_3") .build(consumer, "3")
MatteryRecipe(crate, 24) MatteryRecipe(crate, 24)
.rowB(MItemTags.PLATE_IRON) .rowB(MItemTags.PLATE_IRON)
@ -109,6 +166,6 @@ fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
.rowBC(MItemTags.PLATE_IRON, color) .rowBC(MItemTags.PLATE_IRON, color)
.unlockedBy(MItemTags.PLATE_IRON) .unlockedBy(MItemTags.PLATE_IRON)
.unlockedBy(color) .unlockedBy(color)
.build(consumer, crate.registryName!!.path + "_4") .build(consumer, "4")
} }
} }

View File

@ -141,7 +141,12 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1) {
} }
if (name != null) { if (name != null) {
builder.save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID, name)) builder.save(consumer, ResourceLocation(OverdriveThatMatters.MOD_ID,
if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID)
"${result.asItem().registryName!!.path}_$name"
else
"${result.asItem().registryName!!.namespace}_${result.asItem().registryName!!.path}_$name"
))
} else { } else {
builder.save(consumer) builder.save(consumer)
} }

View File

@ -105,56 +105,6 @@ object MBlocks {
.strength(4f) .strength(4f)
) } ) }
val TRITANIUM_STRIPED_BLOCKS: List<Block>
val TRITANIUM_STRIPED_BLOCKS_COLORS: List<String>
init {
val colors = arrayOf(
"white" to DyeColor.WHITE,
"orange" to DyeColor.ORANGE,
"magenta" to DyeColor.MAGENTA,
"light_blue" to DyeColor.LIGHT_BLUE,
"yellow" to DyeColor.YELLOW,
"lime" to DyeColor.LIME,
"pink" to DyeColor.PINK,
"gray" to DyeColor.GRAY,
"light_gray" to DyeColor.LIGHT_GRAY,
"cyan" to DyeColor.CYAN,
"purple" to DyeColor.PURPLE,
"blue" to DyeColor.BLUE,
"brown" to DyeColor.BROWN,
"green" to DyeColor.GREEN,
"red" to DyeColor.RED,
"black" to DyeColor.BLACK,
)
val listing = ArrayList<() -> Block>()
val listingColors = ArrayList<String>()
for ((colorBase, dyeBase) in colors) {
for ((colorStrip, dyeStrip) in colors) {
if (colorBase == colorStrip) {
continue
}
listingColors.add(colorBase)
val obj = registry.register("${MNames.TRITANIUM_STRIPED_BLOCK}_${colorBase}_$colorStrip") {
Block(BlockBehaviour.Properties.of(Material.METAL, dyeBase.materialColor)
.sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(80f)
.strength(4f))
}
listing.add(obj::get)
}
}
TRITANIUM_STRIPED_BLOCKS = LazyList(*listing.toTypedArray())
TRITANIUM_STRIPED_BLOCKS_COLORS = ImmutableList.copyOf(listingColors)
}
val CARBON_FIBRE_BLOCK: Block by registry.register(MNames.CARBON_FIBRE_BLOCK) { Block( val CARBON_FIBRE_BLOCK: Block by registry.register(MNames.CARBON_FIBRE_BLOCK) { 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)
@ -171,6 +121,7 @@ object MBlocks {
MRegistry.FLOOR_TILES.registerBlocks(registry) MRegistry.FLOOR_TILES.registerBlocks(registry)
MRegistry.VENT.registerBlocks(registry) MRegistry.VENT.registerBlocks(registry)
MRegistry.VENT_ALTERNATIVE.registerBlocks(registry) MRegistry.VENT_ALTERNATIVE.registerBlocks(registry)
MRegistry.TRITANIUM_STRIPED_BLOCK.registerBlocks(registry)
} }
val CRATE_RED: Block by registry.register(MRegistry.CRATE_RED.name) { MRegistry.CRATE_RED.makeBlock() } val CRATE_RED: Block by registry.register(MRegistry.CRATE_RED.name) { MRegistry.CRATE_RED.makeBlock() }

View File

@ -244,52 +244,6 @@ object MItems {
} }
val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) } val TRITANIUM_STRIPED_BLOCK: Item by registry.register(MNames.TRITANIUM_STRIPED_BLOCK) { BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) }
val TRITANIUM_STRIPED_BLOCKS: LazyList<Item>
init {
val colors = arrayOf(
"white",
"orange",
"magenta",
"light_blue",
"yellow",
"lime",
"pink",
"gray",
"light_gray",
"cyan",
"purple",
"blue",
"brown",
"green",
"red",
"black",
)
val listing = ArrayList<() -> Item>()
var i = 0
for (colorBase in colors) {
for (colorStrip in colors) {
if (colorBase == colorStrip) {
continue
}
val iCaptured = i
i++
val obj = registry.register("${MNames.TRITANIUM_STRIPED_BLOCK}_${colorBase}_$colorStrip") {
BlockItem(MBlocks.TRITANIUM_STRIPED_BLOCKS[iCaptured], DEFAULT_PROPERTIES_DECORATIVE)
}
listing.add(obj::get)
}
}
TRITANIUM_STRIPED_BLOCKS = LazyList(*listing.toTypedArray())
}
val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) } val CARBON_FIBRE_BLOCK: Item by registry.register(MNames.CARBON_FIBRE_BLOCK) { BlockItem(MBlocks.CARBON_FIBRE_BLOCK, DEFAULT_PROPERTIES_DECORATIVE) }
init { init {
@ -298,6 +252,6 @@ object MItems {
MRegistry.FLOOR_TILES.registerItems(registry) MRegistry.FLOOR_TILES.registerItems(registry)
MRegistry.VENT.registerItems(registry) MRegistry.VENT.registerItems(registry)
MRegistry.VENT_ALTERNATIVE.registerItems(registry) MRegistry.VENT_ALTERNATIVE.registerItems(registry)
MRegistry.TRITANIUM_STRIPED_BLOCK.registerItems(registry)
} }
} }

View File

@ -27,6 +27,7 @@ import ru.dbotthepony.mc.otm.block.CargoCrateBlock
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
import ru.dbotthepony.mc.otm.registry.objects.CrateProperties import ru.dbotthepony.mc.otm.registry.objects.CrateProperties
import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock
import ru.dbotthepony.mc.otm.registry.objects.StripedColoredDecorativeBlock
import java.util.function.Supplier import java.util.function.Supplier
import kotlin.properties.ReadWriteProperty import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
@ -188,9 +189,13 @@ object MRegistry {
const val DAMAGE_PLASMA_NAME = "otm_plasma" const val DAMAGE_PLASMA_NAME = "otm_plasma"
val DAMAGE_EMP: DamageSource = ImmutableDamageSource(EMPDamageSource()) val DAMAGE_EMP: DamageSource = ImmutableDamageSource(EMPDamageSource())
init { val TRITANIUM_STRIPED_BLOCK = StripedColoredDecorativeBlock(MNames.TRITANIUM_STRIPED_BLOCK, { colorA, _ ->
// DAMAGE_HAWKING_RADIATION.bypassMagic().bypassArmor(); Block(BlockBehaviour.Properties.of(Material.METAL, colorA.materialColor)
} .sound(SoundType.BASALT)
.requiresCorrectToolForDrops()
.explosionResistance(80f)
.strength(4f))
})
fun initialize(context: FMLJavaModLoadingContext) { fun initialize(context: FMLJavaModLoadingContext) {
context.modEventBus.addListener(this::register) context.modEventBus.addListener(this::register)