Skip to content

Commit

Permalink
Add hangingSignBlock method to BlockStateProvider (#1528)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZestyBlaze authored Sep 9, 2024
1 parent 54ef98d commit eb624e8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.CeilingHangingSignBlock;
import net.minecraft.world.level.block.CrossCollisionBlock;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.FenceBlock;
Expand All @@ -42,6 +43,7 @@
import net.minecraft.world.level.block.StandingSignBlock;
import net.minecraft.world.level.block.TrapDoorBlock;
import net.minecraft.world.level.block.WallBlock;
import net.minecraft.world.level.block.WallHangingSignBlock;
import net.minecraft.world.level.block.WallSignBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.AttachFace;
Expand Down Expand Up @@ -481,6 +483,16 @@ public void signBlock(StandingSignBlock signBlock, WallSignBlock wallSignBlock,
simpleBlock(wallSignBlock, sign);
}

public void hangingSignBlock(CeilingHangingSignBlock hangingSignBlock, WallHangingSignBlock wallHangingSignBlock, ResourceLocation texture) {
ModelFile hangingSign = models().sign(name(hangingSignBlock), texture);
hangingSignBlock(hangingSignBlock, wallHangingSignBlock, hangingSign);
}

public void hangingSignBlock(CeilingHangingSignBlock hangingSignBlock, WallHangingSignBlock wallHangingSignBlock, ModelFile hangingSign) {
simpleBlock(hangingSignBlock, hangingSign);
simpleBlock(wallHangingSignBlock, hangingSign);
}

public void fourWayBlock(CrossCollisionBlock block, ModelFile post, ModelFile side) {
MultiPartBlockStateBuilder builder = getMultipartBuilder(block)
.part().modelFile(post).addModel().end();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"textures": {
"particle": "minecraft:block/stripped_acacia_log"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "data_gen_test:block/acacia_hanging_sign"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "data_gen_test:block/acacia_hanging_sign"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ButtonBlock;
import net.minecraft.world.level.block.CeilingHangingSignBlock;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.FenceGateBlock;
import net.minecraft.world.level.block.FurnaceBlock;
Expand All @@ -96,6 +97,7 @@
import net.minecraft.world.level.block.StairBlock;
import net.minecraft.world.level.block.StandingSignBlock;
import net.minecraft.world.level.block.TrapDoorBlock;
import net.minecraft.world.level.block.WallHangingSignBlock;
import net.minecraft.world.level.block.WallSignBlock;
import net.minecraft.world.level.dimension.BuiltinDimensionTypes;
import net.minecraft.world.level.dimension.DimensionType;
Expand Down Expand Up @@ -742,6 +744,7 @@ protected void registerStatesAndModels() {
pressurePlateBlock((PressurePlateBlock) Blocks.ACACIA_PRESSURE_PLATE, blockTexture(Blocks.ACACIA_PLANKS));

signBlock((StandingSignBlock) Blocks.ACACIA_SIGN, (WallSignBlock) Blocks.ACACIA_WALL_SIGN, blockTexture(Blocks.ACACIA_PLANKS));
hangingSignBlock((CeilingHangingSignBlock) Blocks.ACACIA_HANGING_SIGN, (WallHangingSignBlock) Blocks.ACACIA_WALL_HANGING_SIGN, blockTexture(Blocks.STRIPPED_ACACIA_LOG));

simpleBlock(Blocks.TORCH, models().torch("torch", mcLoc("block/torch")));
horizontalBlock(Blocks.WALL_TORCH, models().torchWall("wall_torch", mcLoc("block/torch")), 90);
Expand Down

0 comments on commit eb624e8

Please sign in to comment.