Changes for vanilla wood type bookshelfs
This commit is contained in:
parent
47a744cf23
commit
696e0d5def
4 changed files with 27 additions and 2 deletions
|
@ -26,6 +26,22 @@ import java.util.Optional;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class BaseBookshelfBlock extends BaseBlock {
|
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) {
|
public BaseBookshelfBlock(Block source) {
|
||||||
this(FabricBlockSettings.copyOf(source));
|
this(FabricBlockSettings.copyOf(source));
|
||||||
}
|
}
|
||||||
|
@ -53,7 +69,7 @@ public class BaseBookshelfBlock extends BaseBlock {
|
||||||
return ModelsHelper.fromPattern(pattern);
|
return ModelsHelper.fromPattern(pattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceLocation replacePath(ResourceLocation blockId) {
|
protected ResourceLocation replacePath(ResourceLocation blockId) {
|
||||||
String newPath = blockId.getPath().replace("_bookshelf", "");
|
String newPath = blockId.getPath().replace("_bookshelf", "");
|
||||||
return new ResourceLocation(blockId.getNamespace(), newPath);
|
return new ResourceLocation(blockId.getNamespace(), newPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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_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 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");
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
||||||
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL));
|
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL));
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||||
addBlockEntry(new BlockEntry(
|
addBlockEntry(new BlockEntry(
|
||||||
BLOCK_CRAFTING_TABLE,
|
BLOCK_CRAFTING_TABLE,
|
||||||
(cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))
|
(cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube_column",
|
||||||
|
"textures": {
|
||||||
|
"end": "minecraft:block/%texture%_planks",
|
||||||
|
"side": "%modid%:block/%texture%_bookshelf"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue