[Feature] Slot-based complex Material for Stone
This commit is contained in:
parent
c9e384304e
commit
8fddd5bb79
15 changed files with 486 additions and 43 deletions
|
@ -0,0 +1,50 @@
|
||||||
|
package org.betterx.bclib.complexmaterials;
|
||||||
|
|
||||||
|
import org.betterx.bclib.BCLib;
|
||||||
|
import org.betterx.bclib.behaviours.BehaviourBuilders;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.SlotMap;
|
||||||
|
import org.betterx.bclib.complexmaterials.set.stone.StoneSlots;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
import net.minecraft.world.level.material.MapColor;
|
||||||
|
|
||||||
|
public class StoneComplexMaterial extends ComplexMaterialSet<StoneComplexMaterial> {
|
||||||
|
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("stone_material");
|
||||||
|
public final MapColor color;
|
||||||
|
public final Block sourceBlock;
|
||||||
|
|
||||||
|
protected StoneComplexMaterial(
|
||||||
|
String modID,
|
||||||
|
String baseName,
|
||||||
|
String receipGroupPrefix,
|
||||||
|
Block sourceBlock,
|
||||||
|
MapColor color
|
||||||
|
) {
|
||||||
|
super(modID, baseName, receipGroupPrefix);
|
||||||
|
this.color = color;
|
||||||
|
this.sourceBlock = sourceBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockBehaviour.Properties getBlockSettings() {
|
||||||
|
return BehaviourBuilders.createStone(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getMaterialID() {
|
||||||
|
return MATERIAL_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SlotMap<StoneComplexMaterial> createMaterialSlots() {
|
||||||
|
return SlotMap.of(
|
||||||
|
StoneSlots.SOURCE,
|
||||||
|
StoneSlots.SLAB,
|
||||||
|
StoneSlots.STAIRS,
|
||||||
|
StoneSlots.WALL
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,22 +15,33 @@ import java.util.function.BiFunction;
|
||||||
public class BlockEntry extends ComplexMaterialEntry {
|
public class BlockEntry extends ComplexMaterialEntry {
|
||||||
final BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction;
|
final BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction;
|
||||||
final boolean hasItem;
|
final boolean hasItem;
|
||||||
|
final boolean isPseudoEntry;
|
||||||
|
|
||||||
TagKey<Block>[] blockTags;
|
TagKey<Block>[] blockTags;
|
||||||
TagKey<Item>[] itemTags;
|
TagKey<Item>[] itemTags;
|
||||||
|
|
||||||
public BlockEntry(String suffix, BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction) {
|
public BlockEntry(String suffix, BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction) {
|
||||||
this(suffix, true, initFunction);
|
this(suffix, true, false, initFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockEntry(
|
public BlockEntry(
|
||||||
String suffix,
|
String suffix,
|
||||||
boolean hasItem,
|
boolean hasItem,
|
||||||
BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction
|
BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction
|
||||||
|
) {
|
||||||
|
this(suffix, hasItem, false, initFunction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockEntry(
|
||||||
|
String suffix,
|
||||||
|
boolean hasItem,
|
||||||
|
boolean isPseudoEntry,
|
||||||
|
BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction
|
||||||
) {
|
) {
|
||||||
super(suffix);
|
super(suffix);
|
||||||
this.initFunction = initFunction;
|
this.initFunction = initFunction;
|
||||||
this.hasItem = hasItem;
|
this.hasItem = hasItem;
|
||||||
|
this.isPseudoEntry = isPseudoEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
|
@ -49,17 +60,22 @@ public class BlockEntry extends ComplexMaterialEntry {
|
||||||
ResourceLocation location = getLocation(material.getModID(), material.getBaseName());
|
ResourceLocation location = getLocation(material.getModID(), material.getBaseName());
|
||||||
Block block = initFunction.apply(material, blockSettings);
|
Block block = initFunction.apply(material, blockSettings);
|
||||||
if (block == null) return null;
|
if (block == null) return null;
|
||||||
if (hasItem) {
|
|
||||||
registry.register(location, block);
|
if (!isPseudoEntry) {
|
||||||
if (itemTags != null) {
|
if (hasItem) {
|
||||||
TagManager.ITEMS.add(block.asItem(), itemTags);
|
registry.register(location, block);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
registry.registerBlockOnly(location, block);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
registry.registerBlockOnly(location, block);
|
if (hasItem && itemTags != null) {
|
||||||
|
TagManager.ITEMS.add(block.asItem(), itemTags);
|
||||||
}
|
}
|
||||||
if (blockTags != null) {
|
if (blockTags != null) {
|
||||||
TagManager.BLOCKS.add(block, blockTags);
|
TagManager.BLOCKS.add(block, blockTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.common;
|
||||||
|
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
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 org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public abstract class AbstractSlab<M extends ComplexMaterial> extends SimpleMaterialSlot<M> {
|
||||||
|
public AbstractSlab() {
|
||||||
|
super("slab");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractSlab(String prefix) {
|
||||||
|
super(prefix + "_slab");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
BCLRecipeBuilder
|
||||||
|
.crafting(id, parentMaterial.getBlock(suffix))
|
||||||
|
.setOutputCount(6)
|
||||||
|
.setShape("###")
|
||||||
|
.addMaterial('#', parentMaterial.getBlock(getSourceBlockSlot()))
|
||||||
|
.setGroup("slab")
|
||||||
|
.setCategory(RecipeCategory.BUILDING_BLOCKS)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
protected abstract MaterialSlot<M> getSourceBlockSlot();
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.common;
|
||||||
|
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
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 org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public abstract class AbstractStairs<M extends ComplexMaterial> extends SimpleMaterialSlot<M> {
|
||||||
|
public AbstractStairs() {
|
||||||
|
super("stairs");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractStairs(String prefix) {
|
||||||
|
super(prefix + "_stairs");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
BCLRecipeBuilder
|
||||||
|
.crafting(id, parentMaterial.getBlock(suffix))
|
||||||
|
.setOutputCount(4)
|
||||||
|
.setShape("# ", "## ", "###")
|
||||||
|
.addMaterial('#', parentMaterial.getBlock(getSourceBlockSlot()))
|
||||||
|
.setGroup("stairs")
|
||||||
|
.setCategory(RecipeCategory.BUILDING_BLOCKS)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
protected abstract MaterialSlot<M> getSourceBlockSlot();
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.common;
|
||||||
|
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
|
||||||
|
import org.betterx.bclib.complexmaterials.set.stone.StoneSlots;
|
||||||
|
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public abstract class AbstractWall<M extends ComplexMaterial> extends SimpleMaterialSlot<M> {
|
||||||
|
public AbstractWall() {
|
||||||
|
super("wall");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AbstractWall(@NotNull String postfix) {
|
||||||
|
super(postfix + "_wall");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
|
||||||
|
.setOutputCount(6)
|
||||||
|
.setShape("###", "###")
|
||||||
|
.addMaterial('#', parentMaterial.getBlock(StoneSlots.SOURCE))
|
||||||
|
.setGroup("wall")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
protected abstract MaterialSlot<M> getSourceBlockSlot();
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.blocks.BaseBlock;
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
|
||||||
|
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class CrackedBlock extends SimpleMaterialSlot<StoneComplexMaterial> {
|
||||||
|
public CrackedBlock() {
|
||||||
|
super("cracked");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull Block createBlock(StoneComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
|
||||||
|
return new BaseBlock.Stone(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
BCLRecipeBuilder.smelting(id, parentMaterial.getBlock(suffix))
|
||||||
|
.setPrimaryInputAndUnlock(parentMaterial.getBlock(StoneSlots.SOURCE))
|
||||||
|
.build(false, false, false);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.blocks.BaseSlabBlock;
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
import org.betterx.bclib.complexmaterials.set.common.AbstractSlab;
|
||||||
|
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class Slab extends AbstractSlab<StoneComplexMaterial> {
|
||||||
|
private final MaterialSlot<StoneComplexMaterial> base;
|
||||||
|
|
||||||
|
public Slab() {
|
||||||
|
super();
|
||||||
|
this.base = StoneSlots.SOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Slab(MaterialSlot<StoneComplexMaterial> base) {
|
||||||
|
super(base.suffix);
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull Block createBlock(
|
||||||
|
StoneComplexMaterial parentMaterial, BlockBehaviour.Properties settings
|
||||||
|
) {
|
||||||
|
return new BaseSlabBlock.Stone(parentMaterial.getBlock(getSourceBlockSlot()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
super.makeRecipe(parentMaterial, id);
|
||||||
|
|
||||||
|
BCLRecipeBuilder
|
||||||
|
.stonecutting(
|
||||||
|
new ResourceLocation(id.getNamespace(), "stonecutter_" + id.getPath()),
|
||||||
|
parentMaterial.getBlock(suffix)
|
||||||
|
)
|
||||||
|
.setPrimaryInputAndUnlock(parentMaterial.getBlock(getSourceBlockSlot()))
|
||||||
|
.setOutputCount(2)
|
||||||
|
.setGroup("slab")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
protected MaterialSlot<StoneComplexMaterial> getSourceBlockSlot() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.BlockEntry;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.RecipeEntry;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class Source extends MaterialSlot<StoneComplexMaterial> {
|
||||||
|
public Source() {
|
||||||
|
super("source");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addBlockEntry(StoneComplexMaterial parentMaterial, Consumer<BlockEntry> adder) {
|
||||||
|
adder.accept(new BlockEntry(suffix, true, true, (c, p) -> parentMaterial.sourceBlock));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRecipeEntry(StoneComplexMaterial parentMaterial, Consumer<RecipeEntry> adder) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.blocks.BaseStairsBlock;
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
import org.betterx.bclib.complexmaterials.set.common.AbstractStairs;
|
||||||
|
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class Stairs extends AbstractStairs<StoneComplexMaterial> {
|
||||||
|
private final MaterialSlot<StoneComplexMaterial> base;
|
||||||
|
|
||||||
|
public Stairs() {
|
||||||
|
super();
|
||||||
|
this.base = StoneSlots.SOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Stairs(MaterialSlot<StoneComplexMaterial> base) {
|
||||||
|
super(base.suffix);
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull Block createBlock(
|
||||||
|
StoneComplexMaterial parentMaterial, BlockBehaviour.Properties settings
|
||||||
|
) {
|
||||||
|
return new BaseStairsBlock.Stone(parentMaterial.getBlock(getSourceBlockSlot()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
super.makeRecipe(parentMaterial, id);
|
||||||
|
|
||||||
|
BCLRecipeBuilder
|
||||||
|
.stonecutting(
|
||||||
|
new ResourceLocation(id.getNamespace(), "stonecutter_" + id.getPath()),
|
||||||
|
parentMaterial.getBlock(suffix)
|
||||||
|
)
|
||||||
|
.setPrimaryInputAndUnlock(parentMaterial.getBlock(getSourceBlockSlot()))
|
||||||
|
.setOutputCount(1)
|
||||||
|
.setGroup("stairs")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable MaterialSlot<StoneComplexMaterial> getSourceBlockSlot() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
|
||||||
|
public class StoneSlots {
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> SOURCE = new Source();
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> SLAB = new Slab();
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> STAIRS = new Stairs();
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> WALL = new Wall();
|
||||||
|
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> CRACKED = new CrackedBlock();
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> CRACKED_SLAB = new Slab(CRACKED);
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> CRACKED_STAIRS = new Stairs(CRACKED);
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> CRACKED_WALL = new Wall(CRACKED);
|
||||||
|
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> WEATHERED = new WeatheredBlock();
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> WEATHERED_SLAB = new Slab(WEATHERED);
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> WEATHERED_STAIRS = new Stairs(WEATHERED);
|
||||||
|
public static final MaterialSlot<StoneComplexMaterial> WEATHERED_WALL = new Wall(WEATHERED);
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.blocks.BaseWallBlock;
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
|
import org.betterx.bclib.complexmaterials.set.common.AbstractWall;
|
||||||
|
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class Wall extends AbstractWall<StoneComplexMaterial> {
|
||||||
|
private final MaterialSlot<StoneComplexMaterial> base;
|
||||||
|
|
||||||
|
public Wall() {
|
||||||
|
super();
|
||||||
|
this.base = StoneSlots.SOURCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Wall(MaterialSlot<StoneComplexMaterial> base) {
|
||||||
|
super(base.suffix);
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull Block createBlock(StoneComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
|
||||||
|
return new BaseWallBlock.Stone(parentMaterial.getBlock(getSourceBlockSlot()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
super.makeRecipe(parentMaterial, id);
|
||||||
|
|
||||||
|
BCLRecipeBuilder
|
||||||
|
.stonecutting(
|
||||||
|
new ResourceLocation(id.getNamespace(), "stonecutter_" + id.getPath()),
|
||||||
|
parentMaterial.getBlock(suffix)
|
||||||
|
)
|
||||||
|
.setPrimaryInputAndUnlock(parentMaterial.getBlock(getSourceBlockSlot()))
|
||||||
|
.setOutputCount(1)
|
||||||
|
.setGroup("wall")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable MaterialSlot<StoneComplexMaterial> getSourceBlockSlot() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.betterx.bclib.complexmaterials.set.stone;
|
||||||
|
|
||||||
|
import org.betterx.bclib.blocks.BaseBlock;
|
||||||
|
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.StoneComplexMaterial;
|
||||||
|
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
|
||||||
|
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class WeatheredBlock extends SimpleMaterialSlot<StoneComplexMaterial> {
|
||||||
|
public WeatheredBlock() {
|
||||||
|
super("weathered");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @NotNull Block createBlock(StoneComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
|
||||||
|
return new BaseBlock.Stone(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
||||||
|
BCLRecipeBuilder.crafting(
|
||||||
|
new ResourceLocation(id.getNamespace(), id.getPath() + "_from_moss"),
|
||||||
|
parentMaterial.getBlock(suffix)
|
||||||
|
)
|
||||||
|
.shapeless()
|
||||||
|
.addMaterial('#', parentMaterial.getBlock(StoneSlots.SOURCE))
|
||||||
|
.addMaterial('+', Blocks.MOSS_BLOCK)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
BCLRecipeBuilder.crafting(
|
||||||
|
new ResourceLocation(id.getNamespace(), id.getPath() + "_from_vine"),
|
||||||
|
parentMaterial.getBlock(suffix)
|
||||||
|
)
|
||||||
|
.shapeless()
|
||||||
|
.addMaterial('#', parentMaterial.getBlock(StoneSlots.SOURCE))
|
||||||
|
.addMaterial('+', Blocks.VINE)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,23 +1,17 @@
|
||||||
package org.betterx.bclib.complexmaterials.set.wood;
|
package org.betterx.bclib.complexmaterials.set.wood;
|
||||||
|
|
||||||
import org.betterx.bclib.blocks.BaseSlabBlock;
|
import org.betterx.bclib.blocks.BaseSlabBlock;
|
||||||
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
|
||||||
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
|
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
|
||||||
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
import org.betterx.bclib.complexmaterials.set.common.AbstractSlab;
|
||||||
|
|
||||||
import net.minecraft.data.recipes.RecipeCategory;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class Slab extends SimpleMaterialSlot<WoodenComplexMaterial> {
|
public class Slab extends AbstractSlab<WoodenComplexMaterial> {
|
||||||
public Slab() {
|
|
||||||
super("slab");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull Block createBlock(
|
protected @NotNull Block createBlock(
|
||||||
|
@ -26,15 +20,9 @@ public class Slab extends SimpleMaterialSlot<WoodenComplexMaterial> {
|
||||||
return new BaseSlabBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), !parentMaterial.woodType.flammable);
|
return new BaseSlabBlock.Wood(parentMaterial.getBlock(WoodSlots.PLANKS), !parentMaterial.woodType.flammable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
protected @Nullable MaterialSlot<WoodenComplexMaterial> getSourceBlockSlot() {
|
||||||
BCLRecipeBuilder
|
return WoodSlots.PLANKS;
|
||||||
.crafting(id, parentMaterial.getBlock(suffix))
|
|
||||||
.setOutputCount(6)
|
|
||||||
.setShape("###")
|
|
||||||
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
|
|
||||||
.setGroup("slab")
|
|
||||||
.setCategory(RecipeCategory.BUILDING_BLOCKS)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
package org.betterx.bclib.complexmaterials.set.wood;
|
package org.betterx.bclib.complexmaterials.set.wood;
|
||||||
|
|
||||||
import org.betterx.bclib.blocks.BaseStairsBlock;
|
import org.betterx.bclib.blocks.BaseStairsBlock;
|
||||||
import org.betterx.bclib.complexmaterials.ComplexMaterial;
|
|
||||||
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
|
import org.betterx.bclib.complexmaterials.WoodenComplexMaterial;
|
||||||
import org.betterx.bclib.complexmaterials.entry.SimpleMaterialSlot;
|
import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
|
||||||
import org.betterx.bclib.recipes.BCLRecipeBuilder;
|
import org.betterx.bclib.complexmaterials.set.common.AbstractStairs;
|
||||||
|
|
||||||
import net.minecraft.data.recipes.RecipeCategory;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public class Stairs extends SimpleMaterialSlot<WoodenComplexMaterial> {
|
public class Stairs extends AbstractStairs<WoodenComplexMaterial> {
|
||||||
public Stairs() {
|
|
||||||
super("stairs");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull Block createBlock(
|
protected @NotNull Block createBlock(
|
||||||
|
@ -27,14 +21,7 @@ public class Stairs extends SimpleMaterialSlot<WoodenComplexMaterial> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
|
protected @Nullable MaterialSlot<WoodenComplexMaterial> getSourceBlockSlot() {
|
||||||
BCLRecipeBuilder
|
return WoodSlots.PLANKS;
|
||||||
.crafting(id, parentMaterial.getBlock(suffix))
|
|
||||||
.setOutputCount(4)
|
|
||||||
.setShape("# ", "## ", "###")
|
|
||||||
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
|
|
||||||
.setGroup("stairs")
|
|
||||||
.setCategory(RecipeCategory.BUILDING_BLOCKS)
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class WoodSlots {
|
||||||
public static final MaterialSlot<WoodenComplexMaterial> TABURET = new Taburet();
|
public static final MaterialSlot<WoodenComplexMaterial> TABURET = new Taburet();
|
||||||
public static final MaterialSlot<WoodenComplexMaterial> CHAIR = new Chair();
|
public static final MaterialSlot<WoodenComplexMaterial> CHAIR = new Chair();
|
||||||
public static final MaterialSlot<WoodenComplexMaterial> BAR_STOOL = new BarStool();
|
public static final MaterialSlot<WoodenComplexMaterial> BAR_STOOL = new BarStool();
|
||||||
|
public static final MaterialSlot<WoodenComplexMaterial> WALL = new Wall();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue