This commit is contained in:
DBotThePony 2024-01-02 18:09:16 +07:00
commit b0ca9320ca
Signed by: DBot
GPG Key ID: DCC23B5715498507
3 changed files with 26 additions and 3 deletions

View File

@ -108,6 +108,11 @@ object DataGen {
blockStateProvider.simpleBlockM(block)
}
fun decorativePillar(block: Block, side: String, top: String) {
blockModelProvider.decorativeColumn(block, side, top)
blockStateProvider.simplePillar(block)
}
fun stairs(block: StairBlock, side: String, top: String) {
blockStateProvider.exec {
blockStateProvider.stairsBlock(block, modLocation(side), modLocation(top), modLocation(top))

View File

@ -192,7 +192,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
}
DataGen.decorativeCubeAll(MBlocks.DANGER_STRIPE_BLOCK)
DataGen.decorativeColumn(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top")
DataGen.decorativePillar(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top")
var labLampOn: BlockModelBuilder? = null
var labLampOff: BlockModelBuilder? = null

View File

@ -1,6 +1,8 @@
package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.core.Direction
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.RotatedPillarBlock
import net.minecraft.world.level.block.state.BlockState
import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.client.model.generators.ConfiguredModel
@ -10,10 +12,10 @@ import ru.dbotthepony.mc.otm.core.getValueNullable
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.LinkedList
import java.util.*
typealias BlockStateTransform = (state: BlockState, builder: ConfiguredModel.Builder<*>, path: String) -> String?
private val EMPTY: BlockStateTransform = { _, _, _ -> null }
@ -95,6 +97,22 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
return this
}
fun simplePillar(vararg blocks: Block): MatteryBlockStateProvider {
for (block in blocks) {
exec {
getVariantBuilder(block)
.partialState().with(RotatedPillarBlock.AXIS, Direction.Axis.Y)
.modelForState().modelFile(models().getExistingFile(block.registryName)).addModel()
.partialState().with(RotatedPillarBlock.AXIS, Direction.Axis.Z)
.modelForState().modelFile(models().getExistingFile(block.registryName)).rotationX(90).addModel()
.partialState().with(RotatedPillarBlock.AXIS, Direction.Axis.X)
.modelForState().modelFile(models().getExistingFile(block.registryName)).rotationX(90).rotationY(90).addModel()
}
}
return this
}
fun simpleBlockM(blocks: Collection<Block>): MatteryBlockStateProvider {
blocks.forEach(this::simpleBlockM)
return this