[Change] ComplexMaterials can use MaterialSlots now

This commit is contained in:
Frank 2023-05-20 12:39:20 +02:00
parent cc6d910587
commit f9870d388e
29 changed files with 1554 additions and 392 deletions

View file

@ -3,6 +3,7 @@ package org.betterx.bclib.api.v2.advancement;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.api.v2.levelgen.structures.BCLStructure;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.set.wood.WoodSlots;
import org.betterx.bclib.items.complex.EquipmentSet;
import net.minecraft.advancements.*;
@ -379,9 +380,9 @@ public class AdvancementManager {
public Builder addWoodCriterion(WoodenComplexMaterial mat) {
return addInventoryChangedAnyCriterion(
"got_" + mat.getBaseName(),
mat.getBlock(WoodenComplexMaterial.BLOCK_LOG),
mat.getBlock(WoodenComplexMaterial.BLOCK_BARK),
mat.getBlock(WoodenComplexMaterial.BLOCK_PLANKS)
mat.getBlock(WoodSlots.LOG),
mat.getBlock(WoodSlots.BARK),
mat.getBlock(WoodSlots.PLANKS)
);
}

View file

@ -2,6 +2,7 @@ package org.betterx.bclib.complexmaterials;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.ItemEntry;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
import org.betterx.bclib.complexmaterials.entry.RecipeEntry;
import org.betterx.bclib.registry.BlockRegistry;
import org.betterx.bclib.registry.ItemRegistry;
@ -21,6 +22,7 @@ import com.google.common.collect.Maps;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import org.jetbrains.annotations.Nullable;
public abstract class ComplexMaterial {
@ -162,6 +164,51 @@ public abstract class ComplexMaterial {
return blocks.get(key);
}
/**
* Get initiated {@link Block} from this {@link ComplexMaterial}.
*
* @param key {@link String} block name suffix (example: "mod:custom_log" will have a "log" suffix if "custom" is a base name of this material)
* @param runIfPresent {@link Consumer} to run if block is present.
* @return {@link Block} or {@code null} if nothing is stored.
*/
@Nullable
public Block ifBlockPresent(String key, Consumer<Block> runIfPresent) {
final Block block = blocks.get(key);
if (block != null) {
runIfPresent.accept(block);
}
return block;
}
/**
* Get initiated {@link Block} from this {@link ComplexMaterial}.
*
* @param slot {@link MaterialSlot} The Block Entry
* @param runIfPresent {@link Consumer} to run if block is present.
* @param <M> The {@link ComplexMaterial} this slot is usable for Type
* @return {@link Block} or {@code null} if nothing is stored.
*/
@Nullable
public <M extends ComplexMaterial> Block ifBlockPresent(MaterialSlot<M> slot, Consumer<Block> runIfPresent) {
final Block block = blocks.get(slot.suffix);
if (block != null) {
runIfPresent.accept(block);
}
return block;
}
/**
* Get initiated {@link Block} from this {@link ComplexMaterial}.
*
* @param key {@link MaterialSlot} The Block Entry
* @param <M> The {@link ComplexMaterial} this slot is usable for Type
* @return {@link Block} or {@code null} if nothing is stored.
*/
@Nullable
public <M extends ComplexMaterial> Block getBlock(MaterialSlot<M> key) {
return blocks.get(key.suffix);
}
/**
* Get initiated {@link Item} from this {@link ComplexMaterial}.
*
@ -173,6 +220,52 @@ public abstract class ComplexMaterial {
return items.get(key);
}
/**
* Get initiated {@link Item} from this {@link ComplexMaterial}.
*
* @param slot {@link MaterialSlot} The Item Entry
* @param <M> The {@link ComplexMaterial} this slot is usable for Type
* @return {@link Item} or {@code null} if nothing is stored.
*/
@Nullable
public <M extends ComplexMaterial> Item getItem(MaterialSlot<M> slot) {
return items.get(slot.suffix);
}
/**
* Get initiated {@link Item} from this {@link ComplexMaterial}.
*
* @param key {@link String} item name suffix (example: "mod:custom_apple" will have a "apple" suffix if "custom" is a base name of this material)
* @param runIfPresent {@link Consumer} to run if item is present.
* @return {@link Item} or {@code null} if nothing is stored.
*/
@Nullable
public Item ifItemPresent(String key, Consumer<Item> runIfPresent) {
final Item item = items.get(key);
if (item != null) {
runIfPresent.accept(item);
}
return item;
}
/**
* Get initiated {@link Item} from this {@link ComplexMaterial}.
*
* @param slot {@link MaterialSlot} The Item Entry
* @param runIfPresent {@link Consumer} to run if item is present.
* @param <M> The {@link ComplexMaterial} this slot is usable for Type
* @return {@link Item} or {@code null} if nothing is stored.
*/
@Nullable
public <M extends ComplexMaterial> Item ifItemPresent(MaterialSlot<M> slot, Consumer<Item> runIfPresent) {
final Item item = items.get(slot.suffix);
if (item != null) {
runIfPresent.accept(item);
}
return item;
}
/**
* Get default block settings for this material.
*

View file

@ -0,0 +1,49 @@
package org.betterx.bclib.complexmaterials;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.List;
public abstract class ComplexMaterialSet<M extends ComplexMaterialSet<?>> extends ComplexMaterial {
List<MaterialSlot<M>> slots;
protected ComplexMaterialSet(String modID, String baseName, String receipGroupPrefix) {
super(modID, baseName, receipGroupPrefix);
}
protected abstract List<MaterialSlot<M>> createMaterialSlots();
@Override
protected final void initDefault(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
this.slots = createMaterialSlots();
for (MaterialSlot<M> slot : slots) {
slot.addBlockEntry((M) this, this::addBlockEntry);
}
for (MaterialSlot<M> slot : slots) {
slot.addItemEntry((M) this, this::addItemEntry);
}
this.initAdditional(blockSettings, itemSettings);
}
protected void initAdditional(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
}
@Override
protected final void initDefaultRecipes() {
super.initDefaultRecipes();
this.initAdditionalRecipes();
}
protected void initAdditionalRecipes() {
for (MaterialSlot<M> slot : slots) {
slot.addRecipeEntry((M) this, this::addRecipeEntry);
}
}
}

View file

@ -1,59 +1,56 @@
package org.betterx.bclib.complexmaterials;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.blocks.*;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.RecipeEntry;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import org.betterx.worlds.together.tag.v3.CommonPoiTags;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
import org.betterx.bclib.complexmaterials.set.wood.WoodSlots;
import org.betterx.bclib.items.boat.BoatTypeOverride;
import org.betterx.worlds.together.tag.v3.TagManager;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
public class WoodenComplexMaterial extends ComplexMaterial {
import java.util.List;
import java.util.function.Consumer;
import org.jetbrains.annotations.Nullable;
public class WoodenComplexMaterial extends ComplexMaterialSet<WoodenComplexMaterial> {
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material");
public static final String BLOCK_CRAFTING_TABLE = "crafting_table";
public static final String BLOCK_STRIPPED_BARK = "stripped_bark";
public static final String BLOCK_STRIPPED_LOG = "stripped_log";
public static final String BLOCK_PRESSURE_PLATE = "plate";
public static final String BLOCK_BOOKSHELF = "bookshelf";
public static final String BLOCK_COMPOSTER = "composter";
public static final String BLOCK_TRAPDOOR = "trapdoor";
public static final String BLOCK_BARREL = "barrel";
public static final String BLOCK_BUTTON = "button";
public static final String BLOCK_LADDER = "ladder";
public static final String BLOCK_PLANKS = "planks";
public static final String BLOCK_STAIRS = "stairs";
public static final String BLOCK_CHEST = "chest";
public static final String BLOCK_FENCE = "fence";
public static final String BLOCK_BARK = "bark";
public static final String BLOCK_DOOR = "door";
public static final String BLOCK_GATE = "gate";
public static final String BLOCK_SIGN = "sign";
public static final String BLOCK_WALL_SIGN = "wall_sign";
public static final String BLOCK_SLAB = "slab";
public static final String BLOCK_LOG = "log";
public static final String BLOCK_CRAFTING_TABLE = WoodSlots.CRAFTING_TABLE.suffix;
public static final String BLOCK_STRIPPED_BARK = WoodSlots.STRIPPED_BARK.suffix;
public static final String BLOCK_STRIPPED_LOG = WoodSlots.STRIPPED_LOG.suffix;
public static final String BLOCK_PRESSURE_PLATE = WoodSlots.PRESSURE_PLATE.suffix;
public static final String BLOCK_BOOKSHELF = WoodSlots.BOOKSHELF.suffix;
public static final String BLOCK_COMPOSTER = WoodSlots.COMPOSTER.suffix;
public static final String BLOCK_TRAPDOOR = WoodSlots.TRAPDOOR.suffix;
public static final String BLOCK_BARREL = WoodSlots.BARREL.suffix;
public static final String BLOCK_BUTTON = WoodSlots.BUTTON.suffix;
public static final String BLOCK_LADDER = WoodSlots.LADDER.suffix;
public static final String BLOCK_PLANKS = WoodSlots.PLANKS.suffix;
public static final String BLOCK_STAIRS = WoodSlots.STAIRS.suffix;
public static final String BLOCK_CHEST = WoodSlots.CHEST.suffix;
public static final String BLOCK_FENCE = WoodSlots.FENCE.suffix;
public static final String BLOCK_BARK = WoodSlots.BARK.suffix;
public static final String BLOCK_DOOR = WoodSlots.DOOR.suffix;
public static final String BLOCK_GATE = WoodSlots.GATE.suffix;
public static final String BLOCK_SIGN = WoodSlots.SIGN.suffix;
public static final String BLOCK_WALL_SIGN = WoodSlots.WALL_SIGN;
public static final String BLOCK_SLAB = WoodSlots.SLAB.suffix;
public static final String BLOCK_LOG = WoodSlots.LOG.suffix;
public static final String ITEM_BOAT = WoodSlots.BOAT.suffix;
public static final String ITEM_CHEST_BOAT = WoodSlots.CHEST_BOAT.suffix;
public static final String TAG_LOGS = "logs";
public final MapColor planksColor;
public final MapColor woodColor;
@Nullable
private BoatTypeOverride boatType;
public final BCLWoodTypeWrapper woodType;
@ -63,11 +60,23 @@ public class WoodenComplexMaterial extends ComplexMaterial {
String receipGroupPrefix,
MapColor woodColor,
MapColor planksColor
) {
this(modID, baseName, receipGroupPrefix, woodColor, planksColor, false);
}
public WoodenComplexMaterial(
String modID,
String baseName,
String receipGroupPrefix,
MapColor woodColor,
MapColor planksColor,
boolean withBoats
) {
super(modID, baseName, receipGroupPrefix);
this.planksColor = planksColor;
this.woodColor = woodColor;
this.woodType = BCLWoodTypeWrapper.create(modID, baseName).setColor(planksColor).build();
this.boatType = null;
}
@Override
@ -88,371 +97,61 @@ public class WoodenComplexMaterial extends ComplexMaterial {
}
@Override
protected void initDefault(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
initBase(blockSettings, itemSettings);
initStorage(blockSettings, itemSettings);
initDecorations(blockSettings, itemSettings);
}
protected List<MaterialSlot<WoodenComplexMaterial>> createMaterialSlots() {
final protected void initBase(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
TagKey<Block> tagBlockLog = getBlockTag(TAG_LOGS);
TagKey<Item> tagItemLog = getItemTag(TAG_LOGS);
addBlockEntry(
new BlockEntry(BLOCK_STRIPPED_LOG, (complexMaterial, settings) -> new BaseRotatedPillarBlock(settings))
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
);
addBlockEntry(
new BlockEntry(BLOCK_STRIPPED_BARK, (complexMaterial, settings) -> new BaseBarkBlock(settings))
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
var list = List.of(
WoodSlots.STRIPPED_LOG,
WoodSlots.STRIPPED_BARK,
WoodSlots.LOG,
WoodSlots.BARK,
WoodSlots.PLANKS,
WoodSlots.STAIRS,
WoodSlots.SLAB,
WoodSlots.FENCE,
WoodSlots.GATE,
WoodSlots.BUTTON,
WoodSlots.PRESSURE_PLATE,
WoodSlots.TRAPDOOR,
WoodSlots.DOOR,
WoodSlots.LADDER,
WoodSlots.SIGN,
WoodSlots.CHEST,
WoodSlots.BARREL,
WoodSlots.CRAFTING_TABLE,
WoodSlots.BOOKSHELF,
WoodSlots.COMPOSTER,
WoodSlots.BOAT,
WoodSlots.CHEST_BOAT
);
addBlockEntry(
new BlockEntry(
BLOCK_LOG,
(complexMaterial, settings) -> new BaseStripableLogBlock(
woodColor,
getBlock(BLOCK_STRIPPED_LOG)
)
)
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
);
addBlockEntry(
new BlockEntry(
BLOCK_BARK,
(complexMaterial, settings) -> new StripableBarkBlock(
woodColor,
getBlock(BLOCK_STRIPPED_BARK)
)
)
.setBlockTags(BlockTags.LOGS, BlockTags.LOGS_THAT_BURN, tagBlockLog)
.setItemTags(ItemTags.LOGS, ItemTags.LOGS_THAT_BURN, tagItemLog)
);
addBlockEntry(new BlockEntry(BLOCK_PLANKS, (complexMaterial, settings) -> new BaseBlock(settings))
.setBlockTags(BlockTags.PLANKS)
.setItemTags(ItemTags.PLANKS));
addBlockEntry(new BlockEntry(
BLOCK_STAIRS,
(complexMaterial, settings) -> new BaseStairsBlock(getBlock(BLOCK_PLANKS), false)
)
.setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS)
.setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS));
addBlockEntry(new BlockEntry(
BLOCK_SLAB,
(complexMaterial, settings) -> new BaseSlabBlock(getBlock(BLOCK_PLANKS), false)
)
.setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS)
.setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS));
addBlockEntry(new BlockEntry(
BLOCK_FENCE,
(complexMaterial, settings) -> new BaseFenceBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES)
.setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES));
addBlockEntry(new BlockEntry(
BLOCK_GATE,
(complexMaterial, settings) -> new BaseGateBlock(getBlock(BLOCK_PLANKS), this.woodType.type())
)
.setBlockTags(BlockTags.FENCE_GATES));
addBlockEntry(new BlockEntry(
BLOCK_BUTTON,
(complexMaterial, settings) -> new BaseWoodenButtonBlock(
getBlock(BLOCK_PLANKS),
this.woodType.setType()
)
)
.setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS)
.setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS));
addBlockEntry(new BlockEntry(
BLOCK_PRESSURE_PLATE,
(complexMaterial, settings) -> new WoodenPressurePlateBlock(
getBlock(BLOCK_PLANKS),
this.woodType.setType()
)
)
.setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES)
.setItemTags(ItemTags.WOODEN_PRESSURE_PLATES));
addBlockEntry(new BlockEntry(
BLOCK_TRAPDOOR,
(complexMaterial, settings) -> new BaseTrapdoorBlock(getBlock(BLOCK_PLANKS), this.woodType.setType())
)
.setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS)
.setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS));
addBlockEntry(new BlockEntry(
BLOCK_DOOR,
(complexMaterial, settings) -> new BaseDoorBlock(getBlock(BLOCK_PLANKS), this.woodType.setType())
)
.setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS)
.setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS));
addBlockEntry(new BlockEntry(
BLOCK_LADDER,
(complexMaterial, settings) -> new BaseLadderBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(BlockTags.CLIMBABLE));
addBlockEntry(new BlockEntry(
BLOCK_SIGN,
(complexMaterial, settings) -> new BaseSignBlock(woodType)
)
.setBlockTags(BlockTags.SIGNS)
.setItemTags(ItemTags.SIGNS));
addBlockEntry(new BlockEntry(
BLOCK_WALL_SIGN,
false,
(complexMaterial, settings) -> {
if (getBlock(BLOCK_SIGN) instanceof BaseSignBlock sign) {
return sign.wallSign;
}
return null;
}
)
.setBlockTags(BlockTags.WALL_SIGNS));
}
final protected void initStorage(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
addBlockEntry(new BlockEntry(
BLOCK_CHEST,
(complexMaterial, settings) -> new BaseChestBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(CommonBlockTags.CHEST, CommonBlockTags.WOODEN_CHEST)
.setItemTags(CommonItemTags.CHEST, CommonItemTags.WOODEN_CHEST));
addBlockEntry(new BlockEntry(
BLOCK_BARREL,
(complexMaterial, settings) -> new BaseBarrelBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(CommonBlockTags.BARREL, CommonBlockTags.WOODEN_BARREL)
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL));
}
protected void initDecorations(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
addBlockEntry(new BlockEntry(
BLOCK_CRAFTING_TABLE,
(cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(CommonBlockTags.WORKBENCHES)
.setItemTags(CommonItemTags.WORKBENCHES)
);
addBlockEntry(new BlockEntry(
BLOCK_BOOKSHELF,
(cmx, settings) -> new BaseBookshelfBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(CommonBlockTags.BOOKSHELVES));
addBlockEntry(new BlockEntry(
BLOCK_COMPOSTER,
(complexMaterial, settings) -> new BaseComposterBlock(getBlock(BLOCK_PLANKS))
)
.setBlockTags(CommonPoiTags.FARMER_WORKSTATION));
return list;
}
@Override
protected void initFlammable(FlammableBlockRegistry registry) {
final Consumer<Block> addFlammableHardWood = (Block block) -> registry.add(block, 5, 5);
getBlocks().forEach(block -> {
registry.add(block, 5, 20);
});
registry.add(getBlock(BLOCK_LOG), 5, 5);
registry.add(getBlock(BLOCK_BARK), 5, 5);
registry.add(getBlock(BLOCK_STRIPPED_LOG), 5, 5);
registry.add(getBlock(BLOCK_STRIPPED_BARK), 5, 5);
ifBlockPresent(WoodSlots.LOG, addFlammableHardWood);
ifBlockPresent(WoodSlots.BARK, addFlammableHardWood);
ifBlockPresent(WoodSlots.STRIPPED_LOG, addFlammableHardWood);
ifBlockPresent(WoodSlots.STRIPPED_BARK, addFlammableHardWood);
}
@Override
public void initDefaultRecipes() {
Block planks = getBlock(BLOCK_PLANKS);
addRecipeEntry(new RecipeEntry("planks", (material, id) -> {
Block log_stripped = getBlock(BLOCK_STRIPPED_LOG);
Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK);
Block log = getBlock(BLOCK_LOG);
Block bark = getBlock(BLOCK_BARK);
BCLRecipeBuilder.crafting(id, planks)
.setOutputCount(4)
.shapeless()
.addMaterial('#', log, bark, log_stripped, bark_stripped)
.setGroup("planks")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("stairs", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_STAIRS))
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', planks)
.setGroup("stairs")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("slab", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_SLAB))
.setOutputCount(6)
.setShape("###")
.addMaterial('#', planks)
.setGroup("slab")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("fence", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_FENCE))
.setOutputCount(3)
.setShape("#I#", "#I#")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("fence")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
addRecipeEntry(new RecipeEntry("gate", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_GATE))
.setShape("I#I", "I#I")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("gate")
.setCategory(RecipeCategory.REDSTONE)
.build();
}));
addRecipeEntry(new RecipeEntry("button", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_BUTTON))
.shapeless()
.addMaterial('#', planks)
.setGroup("button")
.setCategory(RecipeCategory.REDSTONE)
.build();
}));
addRecipeEntry(new RecipeEntry("pressure_plate", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_PRESSURE_PLATE))
.setShape("##")
.addMaterial('#', planks)
.setGroup("pressure_plate")
.setCategory(RecipeCategory.REDSTONE)
.build();
}));
addRecipeEntry(new RecipeEntry("trapdoor", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_TRAPDOOR))
.setOutputCount(2)
.setShape("###", "###")
.addMaterial('#', planks)
.setGroup("trapdoor")
.setCategory(RecipeCategory.REDSTONE)
.build();
}));
addRecipeEntry(new RecipeEntry("door", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_DOOR))
.setOutputCount(3)
.setShape("##", "##", "##")
.addMaterial('#', planks)
.setGroup("door")
.setCategory(RecipeCategory.REDSTONE)
.build();
}));
addRecipeEntry(new RecipeEntry("crafting_table", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_CRAFTING_TABLE))
.setShape("##", "##")
.addMaterial('#', planks)
.setGroup("table")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
addRecipeEntry(new RecipeEntry("ladder", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_LADDER))
.setOutputCount(3)
.setShape("I I", "I#I", "I I")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("ladder")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
addRecipeEntry(new RecipeEntry("sign", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_SIGN))
.setOutputCount(3)
.setShape("###", "###", " I ")
.addMaterial('#', planks)
.addMaterial('I', Items.STICK)
.setGroup("sign")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
addRecipeEntry(new RecipeEntry("chest", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_CHEST))
.setShape("###", "# #", "###")
.addMaterial('#', planks)
.setGroup("chest")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
addRecipeEntry(new RecipeEntry("barrel", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_BARREL))
.setShape("#S#", "# #", "#S#")
.addMaterial('#', planks)
.addMaterial('S', getBlock(BLOCK_SLAB))
.setGroup("barrel")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
addRecipeEntry(new RecipeEntry("bookshelf", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_BOOKSHELF))
.setShape("###", "PPP", "###")
.addMaterial('#', planks)
.addMaterial('P', Items.BOOK)
.setGroup("bookshelf")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("bark", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_BARK))
.setShape("##", "##")
.addMaterial('#', getBlock(BLOCK_LOG))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("log", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_LOG))
.setShape("##", "##")
.addMaterial('#', getBlock(BLOCK_BARK))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("stripped_bark", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_STRIPPED_BARK))
.setShape("##", "##")
.addMaterial('#', getBlock(BLOCK_STRIPPED_LOG))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("stripped_log", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_STRIPPED_LOG))
.setShape("##", "##")
.addMaterial('#', getBlock(BLOCK_STRIPPED_BARK))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}));
addRecipeEntry(new RecipeEntry("composter", (material, id) -> {
BCLRecipeBuilder.crafting(id, getBlock(BLOCK_COMPOSTER))
.setShape("# #", "# #", "###")
.addMaterial('#', getBlock(BLOCK_SLAB))
.setGroup("composter")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}));
public void initBoatType() {
if (getBoatType() == null) {
boatType = BoatTypeOverride.create(
getModID(),
getBaseName(),
getBlock(WoodSlots.PLANKS)
);
}
}
public BoatTypeOverride getBoatType() {
return boatType;
}
}

View file

@ -0,0 +1,34 @@
package org.betterx.bclib.complexmaterials.entry;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class MaterialSlot<M extends ComplexMaterial> {
@NotNull
public final String suffix;
public MaterialSlot(@NotNull String suffix) {
this.suffix = suffix;
}
public abstract void addBlockEntry(M parentMaterial, Consumer<BlockEntry> adder);
public abstract void addRecipeEntry(M parentMaterial, Consumer<RecipeEntry> adder);
public void addItemEntry(M parentMaterial, Consumer<ItemEntry> adder) {
ItemEntry item = getItemEntry(parentMaterial);
if (item != null) {
adder.accept(item);
}
}
@Nullable
protected ItemEntry getItemEntry(M parentMaterial) {
return null;
}
public void onInit(M parentMaterial) {
}
}

View file

@ -0,0 +1,68 @@
package org.betterx.bclib.complexmaterials.entry;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.Objects;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class SimpleMaterialSlot<M extends ComplexMaterial> extends MaterialSlot<M> {
public SimpleMaterialSlot(@NotNull String suffix) {
super(suffix);
}
@Override
public void addBlockEntry(M parentMaterial, Consumer<BlockEntry> adder) {
adder.accept(getBlockEntry(parentMaterial));
}
@Nullable
protected BlockEntry getBlockEntry(M parentMaterial) {
var supplier = getBlockSupplier(parentMaterial);
if (supplier != null) {
final BlockEntry entry = new BlockEntry(suffix, supplier);
modifyBlockEntry(parentMaterial, entry);
return entry;
}
return null;
}
protected void modifyBlockEntry(M parentMaterial, @NotNull BlockEntry entry) {
}
@Override
public void addRecipeEntry(M parentMaterial, Consumer<RecipeEntry> adder) {
adder.accept(getRecipeEntry(parentMaterial));
}
@NotNull
protected abstract BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(M parentMaterial);
protected @Nullable RecipeEntry getRecipeEntry(M parentMaterial) {
return new RecipeEntry(suffix, this::getRecipeSupplier);
}
protected abstract @Nullable void getRecipeSupplier(
ComplexMaterial parentMaterial,
ResourceLocation id
);
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof SimpleMaterialSlot)) return false;
SimpleMaterialSlot that = (SimpleMaterialSlot) o;
return suffix.equals(that.suffix);
}
@Override
public int hashCode() {
return Objects.hash(suffix);
}
}

View file

@ -0,0 +1,62 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.StripableBarkBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Bark extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Bark() {
super("bark");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new StripableBarkBlock(
parentMaterial.woodColor,
complexMaterial.getBlock(WoodSlots.STRIPPED_BARK)
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, material.getBlock(suffix))
.setShape("##", "##")
.addMaterial('#', material.getBlock(WoodSlots.LOG))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,50 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBarrelBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Barrel extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Barrel() {
super("barrel");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseBarrelBlock(complexMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(CommonBlockTags.BARREL, CommonBlockTags.WOODEN_BARREL)
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("#S#", "# #", "#S#")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.addMaterial('S', parentMaterial.getBlock(WoodSlots.SLAB))
.setGroup("barrel")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}
}

View file

@ -0,0 +1,58 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.ItemEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Boat extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Boat() {
super("boat");
}
@Override
public void addBlockEntry(WoodenComplexMaterial parentMaterial, Consumer<BlockEntry> adder) {
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (a, b) -> {
return null;
};
}
@Override
protected @Nullable ItemEntry getItemEntry(WoodenComplexMaterial parentMaterial) {
return new ItemEntry(suffix, (cmx, settings) -> parentMaterial.getBoatType().createItem(false));
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("# #", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("boat")
.setCategory(RecipeCategory.TRANSPORTATION)
.build();
}
@Override
public void onInit(WoodenComplexMaterial parentMaterial) {
parentMaterial.initBoatType();
}
}

View file

@ -0,0 +1,49 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBookshelfBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Bookshelf extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Bookshelf() {
super("bookshelf");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (cmx, settings) -> new BaseBookshelfBlock(cmx.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(CommonBlockTags.BOOKSHELVES);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("###", "PPP", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.addMaterial('P', Items.BOOK)
.setGroup("bookshelf")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,52 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseWoodenButtonBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Button extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Button() {
super("button");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseWoodenButtonBlock(
complexMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.BUTTONS, BlockTags.WOODEN_BUTTONS)
.setItemTags(ItemTags.BUTTONS, ItemTags.WOODEN_BUTTONS);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.shapeless()
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("button")
.setCategory(RecipeCategory.REDSTONE)
.build();
}
}

View file

@ -0,0 +1,49 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseChestBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Chest extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Chest() {
super("chest");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseChestBlock(complexMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(CommonBlockTags.CHEST, CommonBlockTags.WOODEN_CHEST)
.setItemTags(CommonItemTags.CHEST, CommonItemTags.WOODEN_CHEST);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("###", "# #", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("chest")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}
}

View file

@ -0,0 +1,64 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.ItemEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ChestBoat extends SimpleMaterialSlot<WoodenComplexMaterial> {
public ChestBoat() {
super("chest_boat");
}
@Override
public void addBlockEntry(WoodenComplexMaterial parentMaterial, Consumer<BlockEntry> adder) {
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (a, b) -> {
return null;
};
}
@Override
protected @Nullable ItemEntry getItemEntry(WoodenComplexMaterial parentMaterial) {
return new ItemEntry(
suffix,
(cmx, settings) -> parentMaterial.getBoatType().createItem(true)
).setItemTags(new TagKey[]{ItemTags.CHEST_BOATS});
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.shapeless()
.addMaterial('C', CommonItemTags.CHEST)
.addMaterial('#', parentMaterial.getBlock(WoodSlots.BOAT))
.setGroup("chest_boat")
.setCategory(RecipeCategory.TRANSPORTATION)
.build();
}
@Override
public void onInit(WoodenComplexMaterial parentMaterial) {
parentMaterial.initBoatType();
}
}

View file

@ -0,0 +1,46 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseComposterBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonPoiTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Composter extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Composter() {
super("composter");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseComposterBlock(complexMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(CommonPoiTags.FARMER_WORKSTATION);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setShape("# #", "# #", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.SLAB))
.setGroup("composter")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}
}

View file

@ -0,0 +1,49 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseCraftingTableBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import org.betterx.worlds.together.tag.v3.CommonBlockTags;
import org.betterx.worlds.together.tag.v3.CommonItemTags;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class CraftingTable extends SimpleMaterialSlot<WoodenComplexMaterial> {
public CraftingTable() {
super("crafting_table");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (cmx, settings) -> new BaseCraftingTableBlock(cmx.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(CommonBlockTags.WORKBENCHES)
.setItemTags(CommonItemTags.WORKBENCHES);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("##", "##")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("table")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}
}

View file

@ -0,0 +1,53 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseDoorBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Door extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Door() {
super("door");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseDoorBlock(
complexMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.DOORS, BlockTags.WOODEN_DOORS)
.setItemTags(ItemTags.DOORS, ItemTags.WOODEN_DOORS);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3)
.setShape("##", "##", "##")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("door")
.setCategory(RecipeCategory.REDSTONE)
.build();
}
}

View file

@ -0,0 +1,52 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseFenceBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Fence extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Fence() {
super("fence");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseFenceBlock(complexMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.FENCES, BlockTags.WOODEN_FENCES)
.setItemTags(ItemTags.FENCES, ItemTags.WOODEN_FENCES);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3)
.setShape("#I#", "#I#")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.addMaterial('I', Items.STICK)
.setGroup("fence")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}
}

View file

@ -0,0 +1,51 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseGateBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Gate extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Gate() {
super("gate");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseGateBlock(
complexMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.type()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.FENCE_GATES);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setShape("I#I", "I#I")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.addMaterial('I', Items.STICK)
.setGroup("gate")
.setCategory(RecipeCategory.REDSTONE)
.build();
}
}

View file

@ -0,0 +1,50 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseLadderBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Ladder extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Ladder() {
super("ladder");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseLadderBlock(complexMaterial.getBlock(WoodSlots.PLANKS));
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.CLIMBABLE);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3)
.setShape("I I", "I#I", "I I")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.addMaterial('I', Items.STICK)
.setGroup("ladder")
.setCategory(RecipeCategory.DECORATIONS)
.build();
}
}

View file

@ -0,0 +1,61 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseStripableLogBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Log extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Log() {
super("log");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseStripableLogBlock(
parentMaterial.woodColor,
complexMaterial.getBlock(WoodSlots.STRIPPED_LOG)
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, material.getBlock(suffix))
.setShape("##", "##")
.addMaterial('#', material.getBlock(WoodSlots.BARK))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,56 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Planks extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Planks() {
super("planks");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseBlock(settings);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(BlockTags.PLANKS)
.setItemTags(ItemTags.PLANKS);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(4)
.shapeless()
.addMaterial(
'#',
parentMaterial.getBlock(WoodSlots.LOG),
parentMaterial.getBlock(WoodSlots.BARK),
parentMaterial.getBlock(WoodSlots.STRIPPED_LOG),
parentMaterial.getBlock(WoodSlots.STRIPPED_BARK)
)
.setGroup("planks")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,52 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.WoodenPressurePlateBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class PressurePlate extends SimpleMaterialSlot<WoodenComplexMaterial> {
public PressurePlate() {
super("plate");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new WoodenPressurePlateBlock(
complexMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES)
.setItemTags(ItemTags.WOODEN_PRESSURE_PLATES);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("##")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("pressure_plate")
.setCategory(RecipeCategory.REDSTONE)
.build();
}
}

View file

@ -0,0 +1,65 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseSignBlock;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
import org.betterx.bclib.complexmaterials.entry.RecipeEntry;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull;
public class Sign extends MaterialSlot<WoodenComplexMaterial> {
@NotNull
public static final String WALL_SUFFFIX = "wall_sign";
public Sign() {
super("sign");
}
@Override
public void addBlockEntry(WoodenComplexMaterial parentMaterial, Consumer<BlockEntry> adder) {
var signEntry = new BlockEntry(
suffix,
(complexMaterial, settings) -> new BaseSignBlock(parentMaterial.woodType)
).setBlockTags(BlockTags.SIGNS)
.setItemTags(ItemTags.SIGNS);
var wallSignEntry = new BlockEntry(
WALL_SUFFFIX,
false,
(complexMaterial, settings) -> {
if (complexMaterial.getBlock(suffix) instanceof BaseSignBlock sign) {
return sign.wallSign;
}
return null;
}
).setBlockTags(BlockTags.WALL_SIGNS);
adder.accept(signEntry);
adder.accept(wallSignEntry);
}
@Override
public void addRecipeEntry(
WoodenComplexMaterial parentMaterial,
Consumer<RecipeEntry> adder
) {
adder.accept(new RecipeEntry(suffix, (mat, id) ->
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3)
.setShape("###", "###", " I ")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.addMaterial('I', Items.STICK)
.setGroup("sign")
.setCategory(RecipeCategory.DECORATIONS)
.build()
));
}
}

View file

@ -0,0 +1,50 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseSlabBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Slab extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Slab() {
super("slab");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseSlabBlock(complexMaterial.getBlock(WoodSlots.PLANKS), false);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.WOODEN_SLABS, BlockTags.SLABS)
.setItemTags(ItemTags.WOODEN_SLABS, ItemTags.SLABS);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(6)
.setShape("###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("slab")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,50 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseStairsBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Stairs extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Stairs() {
super("stairs");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseStairsBlock(complexMaterial.getBlock(WoodSlots.PLANKS), false);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.WOODEN_STAIRS, BlockTags.STAIRS)
.setItemTags(ItemTags.WOODEN_STAIRS, ItemTags.STAIRS);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(4)
.setShape("# ", "## ", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("stairs")
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,58 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseBarkBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class StrippedBark extends SimpleMaterialSlot<WoodenComplexMaterial> {
public StrippedBark() {
super("stripped_bark");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseBarkBlock(settings);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, material.getBlock(suffix))
.setShape("##", "##")
.addMaterial('#', material.getBlock(WoodSlots.STRIPPED_LOG))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,57 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseRotatedPillarBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class StrippedLog extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected StrippedLog() {
super("stripped_log");
}
@Override
@NotNull
protected BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(WoodenComplexMaterial parentMaterial) {
return (complexMaterial, settings) -> new BaseRotatedPillarBlock(settings);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(
BlockTags.LOGS,
BlockTags.LOGS_THAT_BURN,
parentMaterial.getBlockTag(WoodenComplexMaterial.TAG_LOGS)
)
.setItemTags(
ItemTags.LOGS,
ItemTags.LOGS_THAT_BURN,
parentMaterial.getItemTag(WoodenComplexMaterial.TAG_LOGS)
);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder
.crafting(id, material.getBlock(suffix))
.setShape("##", "##")
.addMaterial('#', material.getBlock(WoodSlots.STRIPPED_BARK))
.setOutputCount(3)
.setCategory(RecipeCategory.BUILDING_BLOCKS)
.build();
}
}

View file

@ -0,0 +1,52 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.blocks.BaseTrapdoorBlock;
import org.betterx.bclib.complexmaterials.ComplexMaterial;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Trapdoor extends SimpleMaterialSlot<WoodenComplexMaterial> {
public Trapdoor() {
super("trapdoor");
}
@Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(
WoodenComplexMaterial parentMaterial
) {
return (complexMaterial, settings) -> new BaseTrapdoorBlock(
complexMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType()
);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry.setBlockTags(BlockTags.TRAPDOORS, BlockTags.WOODEN_TRAPDOORS)
.setItemTags(ItemTags.TRAPDOORS, ItemTags.WOODEN_TRAPDOORS);
}
@Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(2)
.setShape("###", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("trapdoor")
.setCategory(RecipeCategory.REDSTONE)
.build();
}
}

View file

@ -0,0 +1,32 @@
package org.betterx.bclib.complexmaterials.set.wood;
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
public class WoodSlots {
public static final MaterialSlot<WoodenComplexMaterial> STRIPPED_LOG = new StrippedLog();
public static final MaterialSlot<WoodenComplexMaterial> STRIPPED_BARK = new StrippedBark();
public static final MaterialSlot<WoodenComplexMaterial> LOG = new Log();
public static final MaterialSlot<WoodenComplexMaterial> BARK = new Bark();
public static final MaterialSlot<WoodenComplexMaterial> PLANKS = new Planks();
public static final MaterialSlot<WoodenComplexMaterial> STAIRS = new Stairs();
public static final MaterialSlot<WoodenComplexMaterial> SLAB = new Slab();
public static final MaterialSlot<WoodenComplexMaterial> FENCE = new Fence();
public static final MaterialSlot<WoodenComplexMaterial> GATE = new Gate();
public static final MaterialSlot<WoodenComplexMaterial> BUTTON = new Button();
public static final MaterialSlot<WoodenComplexMaterial> PRESSURE_PLATE = new PressurePlate();
public static final MaterialSlot<WoodenComplexMaterial> TRAPDOOR = new Trapdoor();
public static final MaterialSlot<WoodenComplexMaterial> DOOR = new Door();
public static final MaterialSlot<WoodenComplexMaterial> LADDER = new Ladder();
public static final Sign SIGN = new Sign();
public static final String WALL_SIGN = Sign.WALL_SUFFFIX;
public static final MaterialSlot<WoodenComplexMaterial> CHEST = new Chest();
public static final MaterialSlot<WoodenComplexMaterial> BARREL = new Barrel();
public static final MaterialSlot<WoodenComplexMaterial> CRAFTING_TABLE = new CraftingTable();
public static final MaterialSlot<WoodenComplexMaterial> BOOKSHELF = new Bookshelf();
public static final MaterialSlot<WoodenComplexMaterial> COMPOSTER = new Composter();
public static final MaterialSlot<WoodenComplexMaterial> BOAT = new Boat();
public static final MaterialSlot<WoodenComplexMaterial> CHEST_BOAT = new ChestBoat();
}