Changes for vanilla wood type bookshelfs

This commit is contained in:
Frank 2022-07-29 15:49:49 +02:00
parent 47a744cf23
commit 696e0d5def
4 changed files with 27 additions and 2 deletions

View file

@ -26,6 +26,22 @@ import java.util.Optional;
import org.jetbrains.annotations.Nullable;
public class BaseBookshelfBlock extends BaseBlock {
public static class WithVanillaWood extends BaseBookshelfBlock {
public WithVanillaWood(Block source) {
super(source);
}
@Override
@Environment(EnvType.CLIENT)
public @Nullable BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
Optional<String> pattern = PatternsHelper.createJson(
BasePatterns.VANILLA_WOOD_BOOKSHELF,
replacePath(blockId)
);
return ModelsHelper.fromPattern(pattern);
}
}
public BaseBookshelfBlock(Block source) {
this(FabricBlockSettings.copyOf(source));
}
@ -53,7 +69,7 @@ public class BaseBookshelfBlock extends BaseBlock {
return ModelsHelper.fromPattern(pattern);
}
private ResourceLocation replacePath(ResourceLocation blockId) {
protected ResourceLocation replacePath(ResourceLocation blockId) {
String newPath = blockId.getPath().replace("_bookshelf", "");
return new ResourceLocation(blockId.getNamespace(), newPath);
}

View file

@ -59,4 +59,6 @@ public class BasePatterns {
public final static ResourceLocation ITEM_HANDHELD = BCLib.makeID("patterns/item/pattern_item_handheld.json");
public final static ResourceLocation ITEM_SPAWN_EGG = BCLib.makeID("patterns/item/pattern_item_spawn_egg.json");
public final static ResourceLocation VANILLA_WOOD_BOOKSHELF = BCLib.makeID(
"patterns/block/vanilla_wood_bookshelf.json");
}

View file

@ -215,7 +215,7 @@ public class WoodenComplexMaterial extends ComplexMaterial {
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL));
}
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
addBlockEntry(new BlockEntry(
BLOCK_CRAFTING_TABLE,
(cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))

View file

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "minecraft:block/%texture%_planks",
"side": "%modid%:block/%texture%_bookshelf"
}
}