Skip to content

Commit

Permalink
✨ Added pillar generator
Browse files Browse the repository at this point in the history
  • Loading branch information
asoji committed Feb 28, 2024
1 parent 6d53669 commit d4fee08
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/main/kotlin/gay/asoji/innerpastels/blocks/Properties.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package gay.asoji.innerpastels.blocks

import gay.asoji.innerpastels.crab.CrabInTheCode
import net.fabricmc.fabric.api.`object`.builder.v1.block.FabricBlockSettings
import net.minecraft.client.resources.model.Material
import net.minecraft.world.level.block.*
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.Blocks
import net.minecraft.world.level.block.LeavesBlock
import net.minecraft.world.level.block.state.BlockBehaviour

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package gay.asoji.innerpastels.crab

import com.mojang.blaze3d.Blaze3D
import gay.asoji.innerpastels.InnerPastels
import gay.asoji.innerpastels.blocks.crab1
import net.fabricmc.api.EnvType
import net.fabricmc.api.Environment

Expand Down
19 changes: 19 additions & 0 deletions src/main/kotlin/gay/asoji/innerpastels/datagen/ModelGenerators.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import gay.asoji.innerpastels.crab.CrabInTheCode
import net.minecraft.data.models.BlockModelGenerators
import net.minecraft.data.models.model.ModelLocationUtils
import net.minecraft.data.models.model.ModelTemplates
import net.minecraft.data.models.model.TextureMapping
import net.minecraft.data.models.model.TexturedModel
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.RotatedPillarBlock

/**
* Model Generators used for Model Data Generation, creating required JSON models for certain blocks, meant to be used with your ModelProvider datagen.
Expand Down Expand Up @@ -239,4 +241,21 @@ object ModelGenerators {
)
blockStateModelGenerator.delegateItemModel(wall, wallInventoryModel)
}

fun createPillar(pillarBlock: RotatedPillarBlock, blockStateModelGenerator: BlockModelGenerators) {
val texture = TextureMapping.logColumn(pillarBlock)
val pillarMain: ResourceLocation = ModelTemplates.CUBE_COLUMN.create(
pillarBlock,
texture,
blockStateModelGenerator.modelOutput
)
val pillarHorizontal: ResourceLocation = ModelTemplates.CUBE_COLUMN_HORIZONTAL.create(
pillarBlock,
texture,
blockStateModelGenerator.modelOutput
)
blockStateModelGenerator.blockStateOutput.accept(
BlockModelGenerators.createRotatedPillarWithHorizontalVariant(pillarBlock, pillarMain, pillarHorizontal)
)
}
}

0 comments on commit d4fee08

Please sign in to comment.