Painted tritanium anvil

This commit is contained in:
DBotThePony 2025-02-22 17:13:02 +07:00
parent 28c7459b82
commit 69c93d4b16
Signed by: DBot
GPG Key ID: DCC23B5715498507
53 changed files with 143 additions and 59 deletions

View File

@ -34,6 +34,10 @@ const child_process = require('child_process');
const bSize = (await getSize(fBase))[2]
const mSize = (await getSize(fMask))[2]
if (subfolder !== '') {
fs.mkdirSync(`${fullBaseFolder}/${subfolder}`, {recursive: true})
}
if (bSize != mSize) {
process.stderr.write(`${fBase} has size of ${bSize}, ${fMask} has size of ${mSize}!\n`)
process.exit(3)

View File

@ -0,0 +1,4 @@
#!/bin/bash
node ./base_with_mask.js block/tritanium_anvil block/tritanium_anvil_mask tritanium_anvil
node ./base_with_mask.js block/tritanium_anvil_top block/tritanium_anvil_top_mask tritanium_anvil_top

View File

@ -1,5 +1,6 @@
package ru.dbotthepony.mc.otm.datagen
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.AnvilBlock
import net.minecraft.world.level.block.SlabBlock
import net.minecraft.world.level.block.StairBlock
@ -37,13 +38,32 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
DataGen.decoratives(MRegistry.TRITANIUM_BLOCK)
for (anvil in MBlocks.TRITANIUM_ANVIL) {
blockStateProvider.exec {
blockStateProvider.getVariantBuilder(anvil).forAllStates {
ConfiguredModel.builder()
.modelFile(blockStateProvider.models().getExistingFile(modLocation("block/${anvil.registryName!!.path}")))
.rotationY(it[AnvilBlock.FACING].yRotationBlockstateNorth())
.build()
for (color in DyeColor.entries) {
blockModelProvider.exec {
blockModelProvider.withExistingParent("block/tritanium_anvil0_${color.name.lowercase()}", "${DataGen.MOD_ID}:block/tritanium_anvil0")
.texture("3", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
.texture("particle", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
}
for (i in 1 until MBlocks.TRITANIUM_ANVIL_VARIANTS) {
blockModelProvider.exec {
blockModelProvider.withExistingParent("block/tritanium_anvil${i}_${color.name.lowercase()}", "${DataGen.MOD_ID}:block/tritanium_anvil$i")
.texture("2", modLocation("block/tritanium_anvil_top/${color.name.lowercase()}"))
.texture("3", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
.texture("particle", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
}
}
}
for (anvils in MBlocks.TRITANIUM_ANVIL.values) {
for (anvil in anvils) {
blockStateProvider.exec {
blockStateProvider.getVariantBuilder(anvil).forAllStates {
ConfiguredModel.builder()
.modelFile(blockStateProvider.models().getExistingFile(modLocation("block/${anvil.registryName!!.path}")))
.rotationY(it[AnvilBlock.FACING].yRotationBlockstateNorth())
.build()
}
}
}
}

View File

@ -16,8 +16,10 @@ fun addMatterData(provider: MatterDataProvider) {
provider.inherit(Items.CHIPPED_ANVIL, Items.ANVIL, 0.75)
provider.inherit(Items.DAMAGED_ANVIL, Items.ANVIL, 0.5)
for (i in 1 until MItems.TRITANIUM_ANVIL.size) {
provider.inherit(MItems.TRITANIUM_ANVIL[i], MItems.TRITANIUM_ANVIL[i - 1], 0.85)
for (anvils in MItems.TRITANIUM_ANVIL.values) {
for (i in 1 until anvils.size) {
provider.inherit(anvils[i], anvils[i - 1], 0.85)
}
}
provider.inherit(Items.WATER_BUCKET, Items.BUCKET) {

View File

@ -247,11 +247,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.block(MItems.MATTER_INPUT_HATCH)
provider.block(MItems.MATTER_OUTPUT_HATCH)
for (item in MItems.TRITANIUM_ANVIL) {
provider.block(item)
}
MItems.TRITANIUM_ANVIL.values.forEach { provider.blocks(it) }
for ((color, item) in MItems.CARGO_CRATE_MINECARTS) {
provider.generated(item)

View File

@ -683,8 +683,15 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.TRITANIUM_BARS, "Tritanium Bars")
add(MBlocks.METAL_RAILING, "Metal Railing")
for (block in MBlocks.TRITANIUM_ANVIL)
add(block, "Tritanium Anvil")
for ((color, blocks) in MBlocks.TRITANIUM_ANVIL.entries) {
if (color == null) {
for (block in blocks)
add(block, "Tritanium Anvil")
} else {
for (block in blocks)
add(block, "${provider.englishColors.mapped[color]} Tritanium Anvil")
}
}
}
}

View File

@ -173,13 +173,13 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
}
}
fun add(map: Map<DyeColor, Block>, toFormat: String) {
fun add(map: Map<in DyeColor, Block>, toFormat: String) {
for ((color, block) in map) {
slave.add(block, toFormat.format(mapped[color]!!))
}
}
fun addIntermediate(map: Map<DyeColor, Block>, toFormat: String) {
fun addIntermediate(map: Map<in DyeColor, Block>, toFormat: String) {
for ((color, block) in map) {
slave.add(block, toFormat.format(if (lowercaseIntermediate) mapped[color]!!.lowercase() else mapped[color]!!))
}

View File

@ -14,12 +14,19 @@ private const val FEELING_SAFE_NOW = "...ощущаете ли вы себя т
private fun decoratives(provider: MatteryLanguageProvider) {
with (provider.russian) {
for (block in MBlocks.TRITANIUM_ANVIL[null]!!)
add(block, "Тритановая наковальня")
for ((color, name) in provider.russianColors.mapped) {
val nameF = name.replace("ый", "ая").replace("ой", "ая").replace("ий", "яя")
add(MRegistry.VENT.getBlock(color), "$nameF вентиляция")
add(MRegistry.VENT_ALTERNATIVE.getBlock(color), "$nameF альтернативная вентиляция")
for (block in MBlocks.TRITANIUM_ANVIL[color]!!) {
add(block, "$nameF тритановая наковальня")
}
val nameMul = name.replace("ый", "ые").replace("ой", "ые").replace("ий", "ие")
add(MRegistry.TRITANIUM_BLOCK.getBlock(color), "$name тритановый блок")
add(MRegistry.COMPUTER_TERMINAL.getBlock(color), "$name компьютерный терминал")
@ -678,9 +685,6 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.TRITANIUM_BARS, "Тритановая решётка")
add(MBlocks.METAL_RAILING, "Металлические перила")
for (block in MBlocks.TRITANIUM_ANVIL)
add(block, "Тритановая наковальня")
}
}

View File

@ -58,8 +58,7 @@ fun addDecorativeLoot(lootTables: LootTables) {
lootTables.dropsSelf(MBlocks.REINFORCED_REDSTONE_LAMP) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.REINFORCED_REDSTONE_LAMP_INVERTED) { condition(ExplosionCondition.survivesExplosion()) }
for (block in MBlocks.TRITANIUM_ANVIL)
lootTables.dropsSelf(block) { condition(ExplosionCondition.survivesExplosion()) }
MBlocks.TRITANIUM_ANVIL.values.forEach { it.forEach { lootTables.dropsSelf(it) { condition(ExplosionCondition.survivesExplosion()) } } }
for (door in MBlocks.TRITANIUM_TRAPDOOR.values)
lootTables.dropsSelf(door) { condition(ExplosionCondition.survivesExplosion()) }

View File

@ -419,7 +419,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.build(consumer, modLocation("decorative/tritanium_bars"))
MatteryRecipe(MItems.TRITANIUM_ANVIL[0], category = RecipeCategory.DECORATIONS)
MatteryRecipe(MItems.TRITANIUM_ANVIL[null]!![0], category = RecipeCategory.DECORATIONS)
.row(MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE)
.rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)

View File

@ -19,6 +19,7 @@ import ru.dbotthepony.mc.otm.recipe.PainterArmorDyeRecipe
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.registry.game.MBlocks
private val Item.recipeName get() = registryName!!.namespace + "/" + registryName!!.path
@ -356,6 +357,10 @@ fun addPainterRecipes(consumer: RecipeOutput) {
generate(consumer, list[null]!!,list)
}
for (i in 0 until MBlocks.TRITANIUM_ANVIL_VARIANTS) {
generate(consumer, MItems.TRITANIUM_ANVIL[null]!![i], DyeColor.entries.associateWith { MItems.TRITANIUM_ANVIL[it]!![i] })
}
generate(consumer, MRegistry.COMPUTER_TERMINAL.item, MRegistry.COMPUTER_TERMINAL.items)
generate(consumer, MRegistry.STAR_CHAIR.item, MRegistry.STAR_CHAIR.items)

View File

@ -96,7 +96,7 @@ fun addMineableTags(tagsProvider: TagsProvider) {
MBlocks.GRAVITATION_STABILIZER_LENS,
), Tiers.DIAMOND)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ANVIL, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() }, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.DEEPSLATE_TRITANIUM_ORE, Tiers.IRON)

View File

@ -5,6 +5,7 @@ import net.minecraft.tags.ItemTags
import net.minecraft.world.effect.MobEffects
import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.kommons.collect.flatMap
import ru.dbotthepony.mc.otm.core.ResourceLocation
import ru.dbotthepony.mc.otm.registry.MBlockTags
import ru.dbotthepony.mc.otm.registry.game.MBlocks
@ -35,8 +36,8 @@ fun addTags(tagsProvider: TagsProvider) {
tagsProvider.items.Appender(MItemTags.MINECART_CARGO_CRATES).add(MItems.CARGO_CRATE_MINECARTS.values)
tagsProvider.blocks.Appender(BlockTags.ANVIL).add(MBlocks.TRITANIUM_ANVIL)
tagsProvider.items.Appender(ItemTags.ANVIL).add(MItems.TRITANIUM_ANVIL)
tagsProvider.blocks.Appender(BlockTags.ANVIL).add(MBlocks.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() })
tagsProvider.items.Appender(ItemTags.ANVIL).add(MItems.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() })
tagsProvider.items.Appender(MItemTags.UPGRADES)
.add(MItems.MachineUpgrades.Basic.LIST)

View File

@ -115,6 +115,11 @@ class TagsProvider(private val event: GatherDataEvent) {
return this
}
fun add(values: Iterator<T>): Appender {
values.forEach { add(it) }
return this
}
fun leaf(name: String) = Appender(TagKey.create(tag.registry, ResourceLocation(tag.location.namespace, tag.location.path + "/$name")))
fun add(leaf: String, value: T) = also { leaf(leaf).add(value) }
@ -327,6 +332,16 @@ class TagsProvider(private val event: GatherDataEvent) {
return this
}
fun requiresPickaxe(blocks: Stream<Block>, tier: Tier? = null): TagsProvider {
for (block in blocks) requiresPickaxe(block, tier)
return this
}
fun requiresPickaxe(blocks: Iterator<Block>, tier: Tier? = null): TagsProvider {
for (block in blocks) requiresPickaxe(block, tier)
return this
}
fun requiresPickaxe(vararg blocks: Block, tier: Tier? = null): TagsProvider {
for (block in blocks) requiresPickaxe(block, tier)
return this

View File

@ -17,17 +17,17 @@ public class MixinAnvilBlock {
remap = false,
cancellable = true)
private static void damage(BlockState pState, CallbackInfoReturnable<BlockState> info) {
var list = MBlocks.INSTANCE.getTRITANIUM_ANVIL();
for (var list : MBlocks.INSTANCE.getTRITANIUM_ANVIL().values()) {
for (int i = 0; i < list.size(); i++) {
if (pState.is(list.get(i))) {
if (i == list.size() - 1) {
info.setReturnValue(null);
} else {
info.setReturnValue(list.get(i + 1).defaultBlockState().setValue(AnvilBlock.FACING, pState.getValue(AnvilBlock.FACING)));
}
for (int i = 0; i < list.size(); i++) {
if (pState.is(list.get(i))) {
if (i == list.size() - 1) {
info.setReturnValue(null);
} else {
info.setReturnValue(list.get(i + 1).defaultBlockState().setValue(AnvilBlock.FACING, pState.getValue(AnvilBlock.FACING)));
return;
}
return;
}
}
}

View File

@ -66,7 +66,8 @@ class CondensedCreativeCompat : CondensedCreativeInitializer {
addByBase(MRegistry.CARGO_CRATES.allItems, MCreativeTabs.DECORATIVE)
addByBase(MItems.CARGO_CRATE_MINECARTS, MCreativeTabs.DECORATIVE)
addByFirst(MItems.TRITANIUM_ANVIL, MCreativeTabs.DECORATIVE)
for (anvils in MItems.TRITANIUM_ANVIL.values)
addByFirst(anvils, MCreativeTabs.DECORATIVE)
addByBase(MRegistry.COMPUTER_TERMINAL.allItems, MCreativeTabs.DECORATIVE)
addByBase(MRegistry.STAR_CHAIR.allItems, MCreativeTabs.DECORATIVE)

View File

@ -4,6 +4,7 @@ import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
import net.minecraft.core.Direction
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.AnvilBlock
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
@ -94,6 +95,10 @@ import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.Collections
import java.util.EnumMap
import java.util.HashMap
import java.util.LinkedHashMap
import java.util.function.Supplier
object MBlocks {
@ -339,24 +344,35 @@ object MBlocks {
const val TRITANIUM_ANVIL_VARIANTS = 7
val TRITANIUM_ANVIL: List<Block>
val TRITANIUM_ANVIL: Map<DyeColor?, List<Block>>
init {
val anvils = ArrayList<Supplier<Block>>()
val map = LinkedHashMap<DyeColor?, List<Block>>()
for (i in 0 until TRITANIUM_ANVIL_VARIANTS) {
val props = BlockBehaviour.Properties.of()
.mapColor(MapColor.COLOR_LIGHT_BLUE)
.sound(SoundType.ANVIL)
.destroyTime(2.5f - i * 0.15f)
.explosionResistance(1200f - i * 80f)
.pushReaction(PushReaction.BLOCK)
.requiresCorrectToolForDrops()
for (color in DyeColor.entries.toMutableList<DyeColor?>().also { it.add(0, null) }) {
val anvils = ArrayList<Supplier<Block>>()
anvils.add(registry.register(MNames.TRITANIUM_ANVIL + i) { AnvilBlock(props) }::get)
for (i in 0 until TRITANIUM_ANVIL_VARIANTS) {
val props = BlockBehaviour.Properties.of()
.mapColor(color?.mapColor ?: MapColor.COLOR_LIGHT_BLUE)
.sound(SoundType.ANVIL)
.destroyTime(2.5f - i * 0.15f)
.explosionResistance(1200f - i * 80f)
.pushReaction(PushReaction.BLOCK)
.requiresCorrectToolForDrops()
var name = MNames.TRITANIUM_ANVIL + i
if (color != null)
name += "_${color.name.lowercase()}"
anvils.add(registry.register(name) { AnvilBlock(props) })
}
map[color] = SupplierList(anvils)
}
TRITANIUM_ANVIL = SupplierList(anvils)
TRITANIUM_ANVIL = Collections.unmodifiableMap(map)
}
val TRITANIUM_DOOR = registry.coloredWithBase(MNames.TRITANIUM_DOOR, ::TritaniumDoorBlock)

View File

@ -213,7 +213,7 @@ private fun addMainCreativeTabItems(consumer: CreativeModeTab.Output) {
base(MItems.TRITANIUM_DOOR)
base(MItems.TRITANIUM_TRAPDOOR)
accept(MRegistry.TRITANIUM_PRESSURE_PLATE.item)
accept(MItems.TRITANIUM_ANVIL[0])
accept(MItems.TRITANIUM_ANVIL[null]!![0])
accept(MItems.GRILL.values)
@ -323,9 +323,7 @@ private fun addDecorativeTabItems(consumer: CreativeModeTab.Output) {
colored(MItems.TRITANIUM_TRAPDOOR)
accept(MRegistry.TRITANIUM_PRESSURE_PLATE.items.values)
for (i in 0 until MItems.TRITANIUM_ANVIL.size)
accept(MItems.TRITANIUM_ANVIL[i])
accept(MItems.TRITANIUM_ANVIL[null]!!)
colored(MRegistry.CARGO_CRATES.items)
colored(MItems.CARGO_CRATE_MINECARTS)

View File

@ -78,6 +78,8 @@ import ru.dbotthepony.mc.otm.registry.MDeferredRegister
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.Collections
import java.util.LinkedHashMap
import java.util.function.Supplier
object MItems {
@ -170,17 +172,27 @@ object MItems {
val ENERGY_OUTPUT_INTERFACE by registry.register(MNames.ENERGY_OUTPUT_INTERFACE) { BlockItem(MBlocks.ENERGY_OUTPUT_INTERFACE, DEFAULT_PROPERTIES) }
val MULTIBLOCK_TEST by registry.register("multiblock_test") { BlockItem(MBlocks.MULTIBLOCK_TEST, Properties().stacksTo(64)) }
val TRITANIUM_ANVIL: List<BlockItem>
val TRITANIUM_ANVIL: Map<DyeColor?, List<BlockItem>>
init {
val props = ArrayList<Supplier<BlockItem>>()
val map = LinkedHashMap<DyeColor?, List<BlockItem>>()
for (i in MBlocks.TRITANIUM_ANVIL.indices) {
props.add(registry.register(MNames.TRITANIUM_ANVIL + i) { BlockItem(MBlocks.TRITANIUM_ANVIL[i], DEFAULT_PROPERTIES) }::get)
for ((color, anvils) in MBlocks.TRITANIUM_ANVIL) {
val props = ArrayList<Supplier<BlockItem>>()
for (i in anvils.indices) {
var name = MNames.TRITANIUM_ANVIL + i
if (color != null)
name += "_${color.name.lowercase()}"
props.add(registry.register(name) { BlockItem(anvils[i], DEFAULT_PROPERTIES) })
}
map[color] = SupplierList(props)
}
TRITANIUM_ANVIL = SupplierList(props)
TRITANIUM_ANVIL = Collections.unmodifiableMap(map)
}
object MachineUpgrades {

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB