Wooden material rename, javadoc fix, recipe entries
This commit is contained in:
parent
4df19c2193
commit
c8d9d9b252
5 changed files with 270 additions and 160 deletions
|
@ -12,6 +12,7 @@ import net.minecraft.world.level.block.Block;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import ru.bclib.complexmaterials.entry.BlockEntry;
|
import ru.bclib.complexmaterials.entry.BlockEntry;
|
||||||
import ru.bclib.complexmaterials.entry.ItemEntry;
|
import ru.bclib.complexmaterials.entry.ItemEntry;
|
||||||
|
import ru.bclib.complexmaterials.entry.RecipeEntry;
|
||||||
import ru.bclib.config.PathConfig;
|
import ru.bclib.config.PathConfig;
|
||||||
import ru.bclib.registry.BlockRegistry;
|
import ru.bclib.registry.BlockRegistry;
|
||||||
import ru.bclib.registry.ItemRegistry;
|
import ru.bclib.registry.ItemRegistry;
|
||||||
|
@ -21,12 +22,15 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class ComplexMaterial {
|
public abstract class ComplexMaterial {
|
||||||
|
private static final Map<ResourceLocation, List<RecipeEntry>> RECIPE_ENTRIES = Maps.newHashMap();
|
||||||
private static final Map<ResourceLocation, List<BlockEntry>> BLOCK_ENTRIES = Maps.newHashMap();
|
private static final Map<ResourceLocation, List<BlockEntry>> BLOCK_ENTRIES = Maps.newHashMap();
|
||||||
private static final Map<ResourceLocation, List<ItemEntry>> ITEM_ENTRIES = Maps.newHashMap();
|
private static final Map<ResourceLocation, List<ItemEntry>> ITEM_ENTRIES = Maps.newHashMap();
|
||||||
private static final List<ComplexMaterial> MATERIALS = Lists.newArrayList();
|
private static final List<ComplexMaterial> MATERIALS = Lists.newArrayList();
|
||||||
|
|
||||||
|
private final List<RecipeEntry> defaultRecipeEntries = Lists.newArrayList();
|
||||||
private final List<BlockEntry> defaultBlockEntries = Lists.newArrayList();
|
private final List<BlockEntry> defaultBlockEntries = Lists.newArrayList();
|
||||||
private final List<ItemEntry> defaultItemEntries = Lists.newArrayList();
|
private final List<ItemEntry> defaultItemEntries = Lists.newArrayList();
|
||||||
|
|
||||||
private final Map<String, Tag.Named<Block>> blockTags = Maps.newHashMap();
|
private final Map<String, Tag.Named<Block>> blockTags = Maps.newHashMap();
|
||||||
private final Map<String, Tag.Named<Item>> itemTags = Maps.newHashMap();
|
private final Map<String, Tag.Named<Item>> itemTags = Maps.newHashMap();
|
||||||
private final Map<String, Block> blocks = Maps.newHashMap();
|
private final Map<String, Block> blocks = Maps.newHashMap();
|
||||||
|
@ -64,8 +68,12 @@ public abstract class ComplexMaterial {
|
||||||
Item item = entry.init(this, itemSettings, itemsRegistry);
|
Item item = entry.init(this, itemSettings, itemsRegistry);
|
||||||
items.put(entry.getSuffix(), item);
|
items.put(entry.getSuffix(), item);
|
||||||
});
|
});
|
||||||
|
|
||||||
initRecipes(recipeConfig);
|
initDefaultRecipes();
|
||||||
|
getRecipeEntries().forEach(entry -> {
|
||||||
|
entry.init(this, recipeConfig);
|
||||||
|
});
|
||||||
|
|
||||||
initFlammable(FlammableBlockRegistry.getDefaultInstance());
|
initFlammable(FlammableBlockRegistry.getDefaultInstance());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -83,9 +91,9 @@ public abstract class ComplexMaterial {
|
||||||
protected void initTags() {}
|
protected void initTags() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init custom recipes for this {@link ComplexMaterial}, not required.
|
* Init default recipes for this {@link ComplexMaterial}, not required.
|
||||||
*/
|
*/
|
||||||
protected void initRecipes(PathConfig recipeConfig) {}
|
protected void initDefaultRecipes() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows to add blocks into Fabric {@link FlammableBlockRegistry} for this {@link ComplexMaterial}, not required.
|
* Allows to add blocks into Fabric {@link FlammableBlockRegistry} for this {@link ComplexMaterial}, not required.
|
||||||
|
@ -181,6 +189,15 @@ public abstract class ComplexMaterial {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Collection<RecipeEntry> getRecipeEntries() {
|
||||||
|
List<RecipeEntry> result = Lists.newArrayList(defaultRecipeEntries);
|
||||||
|
List<RecipeEntry> entries = RECIPE_ENTRIES.get(this.getMaterialID());
|
||||||
|
if (entries != null) {
|
||||||
|
result.addAll(entries);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get base name of this {@link ComplexMaterial}.
|
* Get base name of this {@link ComplexMaterial}.
|
||||||
|
@ -202,8 +219,8 @@ public abstract class ComplexMaterial {
|
||||||
* Get a unique {@link ResourceLocation} for each material class.
|
* Get a unique {@link ResourceLocation} for each material class.
|
||||||
* For example WoodenComplexMaterial will have a "bclib:Wooden_Complex_Material" {@link ResourceLocation}.
|
* For example WoodenComplexMaterial will have a "bclib:Wooden_Complex_Material" {@link ResourceLocation}.
|
||||||
* This is used to add custom entries before mods init using Fabric "preLaunch" entry point.
|
* This is used to add custom entries before mods init using Fabric "preLaunch" entry point.
|
||||||
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint>Fabric Documentation: Entrypoint</a>
|
|
||||||
* @return {@link ResourceLocation} for this material
|
* @return {@link ResourceLocation} for this material
|
||||||
|
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint">Fabric Documentation: Entrypoint</a>
|
||||||
*/
|
*/
|
||||||
public abstract ResourceLocation getMaterialID();
|
public abstract ResourceLocation getMaterialID();
|
||||||
|
|
||||||
|
@ -238,14 +255,22 @@ public abstract class ComplexMaterial {
|
||||||
protected void addItemEntry(ItemEntry entry) {
|
protected void addItemEntry(ItemEntry entry) {
|
||||||
defaultItemEntries.add(entry);
|
defaultItemEntries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a default {@link RecipeEntry} to this {@link ComplexMaterial}. Used to initiate items later.
|
||||||
|
* @param entry {@link RecipeEntry}
|
||||||
|
*/
|
||||||
|
protected void addRecipeEntry(RecipeEntry entry) {
|
||||||
|
defaultRecipeEntries.add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a custom {@link BlockEntry} for specified {@link ComplexMaterial} using its {@link ResourceLocation}.
|
* Adds a custom {@link BlockEntry} for specified {@link ComplexMaterial} using its {@link ResourceLocation}.
|
||||||
* Used to add custom entry for all instances of {@link ComplexMaterial}.
|
* Used to add custom entry for all instances of {@link ComplexMaterial}.
|
||||||
* Should be called only using Fabric "preLaunch" entry point.
|
* Should be called only using Fabric "preLaunch" entry point.
|
||||||
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint>Fabric Documentation: Entrypoint</a>
|
|
||||||
* @param materialName {@link ResourceLocation} id of {@link ComplexMaterial};
|
* @param materialName {@link ResourceLocation} id of {@link ComplexMaterial};
|
||||||
* @param entry {@link BlockEntry}.
|
* @param entry {@link BlockEntry}.
|
||||||
|
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint">Fabric Documentation: Entrypoint</a>
|
||||||
*/
|
*/
|
||||||
public static void addBlockEntry(ResourceLocation materialName, BlockEntry entry) {
|
public static void addBlockEntry(ResourceLocation materialName, BlockEntry entry) {
|
||||||
List<BlockEntry> entries = BLOCK_ENTRIES.get(materialName);
|
List<BlockEntry> entries = BLOCK_ENTRIES.get(materialName);
|
||||||
|
@ -260,9 +285,9 @@ public abstract class ComplexMaterial {
|
||||||
* Adds a custom {@link ItemEntry} for specified {@link ComplexMaterial} using its {@link ResourceLocation}.
|
* Adds a custom {@link ItemEntry} for specified {@link ComplexMaterial} using its {@link ResourceLocation}.
|
||||||
* Used to add custom entry for all instances of {@link ComplexMaterial}.
|
* Used to add custom entry for all instances of {@link ComplexMaterial}.
|
||||||
* Should be called only using Fabric "preLaunch" entry point.
|
* Should be called only using Fabric "preLaunch" entry point.
|
||||||
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint>Fabric Documentation: Entrypoint</a>
|
|
||||||
* @param materialName {@link ResourceLocation} id of {@link ComplexMaterial};
|
* @param materialName {@link ResourceLocation} id of {@link ComplexMaterial};
|
||||||
* @param entry {@link ItemEntry}.
|
* @param entry {@link ItemEntry}.
|
||||||
|
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint">Fabric Documentation: Entrypoint</a>
|
||||||
*/
|
*/
|
||||||
public static void addItemEntry(ResourceLocation materialName, ItemEntry entry) {
|
public static void addItemEntry(ResourceLocation materialName, ItemEntry entry) {
|
||||||
List<ItemEntry> entries = ITEM_ENTRIES.get(materialName);
|
List<ItemEntry> entries = ITEM_ENTRIES.get(materialName);
|
||||||
|
@ -272,6 +297,23 @@ public abstract class ComplexMaterial {
|
||||||
}
|
}
|
||||||
entries.add(entry);
|
entries.add(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a custom {@link RecipeEntry} for specified {@link ComplexMaterial} using its {@link ResourceLocation}.
|
||||||
|
* Used to add custom entry for all instances of {@link ComplexMaterial}.
|
||||||
|
* Should be called only using Fabric "preLaunch" entry point.
|
||||||
|
* @param materialName {@link ResourceLocation} id of {@link ComplexMaterial};
|
||||||
|
* @param entry {@link RecipeEntry}.
|
||||||
|
* @see <a href="https://fabricmc.net/wiki/documentation:entrypoint">Fabric Documentation: Entrypoint</a>
|
||||||
|
*/
|
||||||
|
public static void addRecipeEntry(ResourceLocation materialName, RecipeEntry entry) {
|
||||||
|
List<RecipeEntry> entries = RECIPE_ENTRIES.get(materialName);
|
||||||
|
if (entries == null) {
|
||||||
|
entries = Lists.newArrayList();
|
||||||
|
RECIPE_ENTRIES.put(materialName, entries);
|
||||||
|
}
|
||||||
|
entries.add(entry);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all instances of all materials.
|
* Get all instances of all materials.
|
||||||
|
|
|
@ -37,12 +37,13 @@ import ru.bclib.blocks.StripableBarkBlock;
|
||||||
import ru.bclib.blocks.WoodenPressurePlateBlock;
|
import ru.bclib.blocks.WoodenPressurePlateBlock;
|
||||||
import ru.bclib.complexmaterials.entry.BlockEntry;
|
import ru.bclib.complexmaterials.entry.BlockEntry;
|
||||||
import ru.bclib.complexmaterials.entry.ItemEntry;
|
import ru.bclib.complexmaterials.entry.ItemEntry;
|
||||||
|
import ru.bclib.complexmaterials.entry.RecipeEntry;
|
||||||
import ru.bclib.config.PathConfig;
|
import ru.bclib.config.PathConfig;
|
||||||
import ru.bclib.recipes.GridRecipe;
|
import ru.bclib.recipes.GridRecipe;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class WoodenMaterial extends ComplexMaterial {
|
public class WoodenComplexMaterial extends ComplexMaterial {
|
||||||
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material");
|
public static final ResourceLocation MATERIAL_ID = BCLib.makeID("wooden_material");
|
||||||
|
|
||||||
public static final String BLOCK_CRAFTING_TABLE = "crafting_table";
|
public static final String BLOCK_CRAFTING_TABLE = "crafting_table";
|
||||||
|
@ -71,7 +72,7 @@ public class WoodenMaterial extends ComplexMaterial {
|
||||||
public final MaterialColor planksColor;
|
public final MaterialColor planksColor;
|
||||||
public final MaterialColor woodColor;
|
public final MaterialColor woodColor;
|
||||||
|
|
||||||
public WoodenMaterial(String modID, String baseName, MaterialColor woodColor, MaterialColor planksColor) {
|
public WoodenComplexMaterial(String modID, String baseName, MaterialColor woodColor, MaterialColor planksColor) {
|
||||||
super(modID, baseName);
|
super(modID, baseName);
|
||||||
this.planksColor = planksColor;
|
this.planksColor = planksColor;
|
||||||
this.woodColor = woodColor;
|
this.woodColor = woodColor;
|
||||||
|
@ -193,154 +194,192 @@ public class WoodenMaterial extends ComplexMaterial {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initRecipes(PathConfig recipeConfig) {
|
public void initDefaultRecipes() {
|
||||||
Block log_stripped = getBlock(BLOCK_STRIPPED_LOG);
|
|
||||||
Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK);
|
|
||||||
Block log = getBlock(BLOCK_LOG);
|
|
||||||
Block bark = getBlock(BLOCK_BARK);
|
|
||||||
Block planks = getBlock(BLOCK_PLANKS);
|
Block planks = getBlock(BLOCK_PLANKS);
|
||||||
Block stairs = getBlock(BLOCK_STAIRS);
|
addRecipeEntry(new RecipeEntry("planks", (material, config, id) -> {
|
||||||
Block slab = getBlock(BLOCK_SLAB);
|
Block log_stripped = getBlock(BLOCK_STRIPPED_LOG);
|
||||||
Block fence = getBlock(BLOCK_FENCE);
|
Block bark_stripped = getBlock(BLOCK_STRIPPED_BARK);
|
||||||
Block gate = getBlock("gate");
|
Block log = getBlock(BLOCK_LOG);
|
||||||
Block button = getBlock("button");
|
Block bark = getBlock(BLOCK_BARK);
|
||||||
Block pressurePlate = getBlock("plate");
|
GridRecipe.make(id, planks)
|
||||||
Block trapdoor = getBlock("trapdoor");
|
.checkConfig(config)
|
||||||
Block door = getBlock("door");
|
.setOutputCount(4)
|
||||||
Block craftingTable = getBlock("crafting_table");
|
.setList("#")
|
||||||
Block ladder = getBlock("ladder");
|
.addMaterial('#', log, bark, log_stripped, bark_stripped)
|
||||||
Block sign = getBlock("sign");
|
.setGroup("end_planks")
|
||||||
Block chest = getBlock("chest");
|
.build();
|
||||||
Block barrel = getBlock("barrel");
|
}));
|
||||||
Block shelf = getBlock("bookshelf");
|
addRecipeEntry(new RecipeEntry("stairs", (material, config, id) -> {
|
||||||
Block composter = getBlock("composter");
|
GridRecipe.make(id, getBlock(BLOCK_STAIRS))
|
||||||
|
.checkConfig(config)
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_planks", planks)
|
.setOutputCount(4)
|
||||||
.checkConfig(recipeConfig)
|
.setShape("# ", "## ", "###")
|
||||||
.setOutputCount(4)
|
.addMaterial('#', planks)
|
||||||
.setList("#")
|
.setGroup("end_planks_stairs")
|
||||||
.addMaterial('#', log, bark, log_stripped, bark_stripped)
|
.build();
|
||||||
.setGroup("end_planks")
|
}));
|
||||||
.build();
|
addRecipeEntry(new RecipeEntry("slab", (material, config, id) -> {
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_stairs", stairs)
|
GridRecipe.make(id, getBlock(BLOCK_SLAB))
|
||||||
.checkConfig(recipeConfig)
|
.checkConfig(config)
|
||||||
.setOutputCount(4)
|
.setOutputCount(6)
|
||||||
.setShape("# ", "## ", "###")
|
.setShape("###")
|
||||||
.addMaterial('#', planks)
|
.addMaterial('#', planks)
|
||||||
.setGroup("end_planks_stairs")
|
.setGroup("end_planks_slabs")
|
||||||
.build();
|
.build();
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_slab", slab)
|
}));
|
||||||
.checkConfig(recipeConfig)
|
addRecipeEntry(new RecipeEntry("fence", (material, config, id) -> {
|
||||||
.setOutputCount(6)
|
GridRecipe.make(id, getBlock(BLOCK_FENCE))
|
||||||
.setShape("###")
|
.checkConfig(config)
|
||||||
.addMaterial('#', planks)
|
.setOutputCount(3)
|
||||||
.setGroup("end_planks_slabs")
|
.setShape("#I#", "#I#")
|
||||||
.build();
|
.addMaterial('#', planks)
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_fence", fence)
|
.addMaterial('I', Items.STICK)
|
||||||
.checkConfig(recipeConfig)
|
.setGroup("end_planks_fences")
|
||||||
.setOutputCount(3)
|
.build();
|
||||||
.setShape("#I#", "#I#")
|
}));
|
||||||
.addMaterial('#', planks)
|
addRecipeEntry(new RecipeEntry("gate", (material, config, id) -> {
|
||||||
.addMaterial('I', Items.STICK)
|
GridRecipe.make(id, getBlock(BLOCK_GATE))
|
||||||
.setGroup("end_planks_fences")
|
.checkConfig(config)
|
||||||
.build();
|
.setShape("I#I", "I#I")
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_gate", gate)
|
.addMaterial('#', planks)
|
||||||
.checkConfig(recipeConfig)
|
.addMaterial('I', Items.STICK)
|
||||||
.setShape("I#I", "I#I")
|
.setGroup("end_planks_gates")
|
||||||
.addMaterial('#', planks)
|
.build();
|
||||||
.addMaterial('I', Items.STICK)
|
}));
|
||||||
.setGroup("end_planks_gates")
|
addRecipeEntry(new RecipeEntry("button", (material, config, id) -> {
|
||||||
.build();
|
GridRecipe.make(id, getBlock(BLOCK_BUTTON))
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_button", button)
|
.checkConfig(config)
|
||||||
.checkConfig(recipeConfig)
|
.setList("#")
|
||||||
.setList("#")
|
.addMaterial('#', planks)
|
||||||
.addMaterial('#', planks)
|
.setGroup("end_planks_buttons")
|
||||||
.setGroup("end_planks_buttons")
|
.build();
|
||||||
.build();
|
}));
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_pressure_plate", pressurePlate)
|
addRecipeEntry(new RecipeEntry("pressure_plate", (material, config, id) -> {
|
||||||
.checkConfig(recipeConfig)
|
GridRecipe.make(id, getBlock(BLOCK_PRESSURE_PLATE))
|
||||||
.setShape("##")
|
.checkConfig(config)
|
||||||
.addMaterial('#', planks)
|
.setShape("##")
|
||||||
.setGroup("end_planks_plates")
|
.addMaterial('#', planks)
|
||||||
.build();
|
.setGroup("end_planks_plates")
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_trapdoor", trapdoor)
|
.build();
|
||||||
.checkConfig(recipeConfig)
|
}));
|
||||||
.setOutputCount(2)
|
addRecipeEntry(new RecipeEntry("trapdoor", (material, config, id) -> {
|
||||||
.setShape("###", "###")
|
GridRecipe.make(id, getBlock(BLOCK_TRAPDOOR))
|
||||||
.addMaterial('#', planks)
|
.checkConfig(config)
|
||||||
.setGroup("end_trapdoors")
|
.setOutputCount(2)
|
||||||
.build();
|
.setShape("###", "###")
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_door", door)
|
.addMaterial('#', planks)
|
||||||
.checkConfig(recipeConfig)
|
.setGroup("end_trapdoors")
|
||||||
.setOutputCount(3)
|
.build();
|
||||||
.setShape("##", "##", "##")
|
}));
|
||||||
.addMaterial('#', planks)
|
addRecipeEntry(new RecipeEntry("door", (material, config, id) -> {
|
||||||
.setGroup("end_doors")
|
GridRecipe.make(id, getBlock(BLOCK_DOOR))
|
||||||
.build();
|
.checkConfig(config)
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_crafting_table", craftingTable)
|
.setOutputCount(3)
|
||||||
.checkConfig(recipeConfig)
|
.setShape("##", "##", "##")
|
||||||
.setShape("##", "##")
|
.addMaterial('#', planks)
|
||||||
.addMaterial('#', planks)
|
.setGroup("end_doors")
|
||||||
.setGroup("end_tables")
|
.build();
|
||||||
.build();
|
}));
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_ladder", ladder)
|
addRecipeEntry(new RecipeEntry("crafting_table", (material, config, id) -> {
|
||||||
.checkConfig(recipeConfig)
|
GridRecipe.make(id, getBlock(BLOCK_CRAFTING_TABLE))
|
||||||
.setOutputCount(3)
|
.checkConfig(config)
|
||||||
.setShape("I I", "I#I", "I I")
|
.setShape("##", "##")
|
||||||
.addMaterial('#', planks)
|
.addMaterial('#', planks)
|
||||||
.addMaterial('I', Items.STICK)
|
.setGroup("end_tables")
|
||||||
.setGroup("end_ladders")
|
.build();
|
||||||
.build();
|
}));
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_sign", sign)
|
addRecipeEntry(new RecipeEntry("ladder", (material, config, id) -> {
|
||||||
.checkConfig(recipeConfig)
|
GridRecipe.make(id, getBlock(BLOCK_LADDER))
|
||||||
.setOutputCount(3)
|
.checkConfig(config)
|
||||||
.setShape("###", "###", " I ")
|
.setOutputCount(3)
|
||||||
.addMaterial('#', planks)
|
.setShape("I I", "I#I", "I I")
|
||||||
.addMaterial('I', Items.STICK)
|
.addMaterial('#', planks)
|
||||||
.setGroup("end_signs")
|
.addMaterial('I', Items.STICK)
|
||||||
.build();
|
.setGroup("end_ladders")
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_chest", chest)
|
.build();
|
||||||
.checkConfig(recipeConfig)
|
}));
|
||||||
.setShape("###", "# #", "###")
|
addRecipeEntry(new RecipeEntry("sign", (material, config, id) -> {
|
||||||
.addMaterial('#', planks)
|
GridRecipe.make(id, getBlock(BLOCK_SIGN))
|
||||||
.setGroup("end_chests")
|
.checkConfig(config)
|
||||||
.build();
|
.setOutputCount(3)
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_barrel", barrel)
|
.setShape("###", "###", " I ")
|
||||||
.checkConfig(recipeConfig)
|
.addMaterial('#', planks)
|
||||||
.setShape("#S#", "# #", "#S#")
|
.addMaterial('I', Items.STICK)
|
||||||
.addMaterial('#', planks)
|
.setGroup("end_signs")
|
||||||
.addMaterial('S', slab)
|
.build();
|
||||||
.setGroup("end_barrels")
|
}));
|
||||||
.build();
|
addRecipeEntry(new RecipeEntry("chest", (material, config, id) -> {
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_bookshelf", shelf)
|
GridRecipe.make(id, getBlock(BLOCK_CHEST))
|
||||||
.checkConfig(recipeConfig)
|
.checkConfig(config)
|
||||||
.setShape("###", "PPP", "###")
|
.setShape("###", "# #", "###")
|
||||||
.addMaterial('#', planks)
|
.addMaterial('#', planks)
|
||||||
.addMaterial('P', Items.BOOK)
|
.setGroup("end_chests")
|
||||||
.setGroup("end_BLOCK_BOOKSHELVES")
|
.build();
|
||||||
.build();
|
}));
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_bark", bark)
|
addRecipeEntry(new RecipeEntry("barrel", (material, config, id) -> {
|
||||||
.checkConfig(recipeConfig)
|
GridRecipe.make(id, getBlock(BLOCK_BARREL))
|
||||||
.setShape("##", "##")
|
.checkConfig(config)
|
||||||
.addMaterial('#', log)
|
.setShape("#S#", "# #", "#S#")
|
||||||
.setOutputCount(3)
|
.addMaterial('#', planks)
|
||||||
.build();
|
.addMaterial('S', getBlock(BLOCK_SLAB))
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_log", log)
|
.setGroup("end_barrels")
|
||||||
.checkConfig(recipeConfig)
|
.build();
|
||||||
.setShape("##", "##")
|
}));
|
||||||
.addMaterial('#', bark)
|
addRecipeEntry(new RecipeEntry("bookshelf", (material, config, id) -> {
|
||||||
.setOutputCount(3)
|
GridRecipe.make(id, getBlock(BLOCK_BOOKSHELF))
|
||||||
.build();
|
.checkConfig(config)
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_composter", composter)
|
.setShape("###", "PPP", "###")
|
||||||
.checkConfig(recipeConfig)
|
.addMaterial('#', planks)
|
||||||
.setShape("# #", "# #", "###")
|
.addMaterial('P', Items.BOOK)
|
||||||
.addMaterial('#', slab)
|
.setGroup("end_bookshelves")
|
||||||
.build();
|
.build();
|
||||||
GridRecipe.make(getModID(), getBaseName() + "_shulker", Items.SHULKER_BOX)
|
}));
|
||||||
.checkConfig(recipeConfig)
|
addRecipeEntry(new RecipeEntry("bark", (material, config, id) -> {
|
||||||
.setShape("S", "#", "S")
|
GridRecipe.make(id, getBlock(BLOCK_BARK))
|
||||||
.addMaterial('S', Items.SHULKER_SHELL)
|
.checkConfig(config)
|
||||||
.addMaterial('#', chest)
|
.setShape("##", "##")
|
||||||
.build();
|
.addMaterial('#', getBlock(BLOCK_LOG))
|
||||||
|
.setOutputCount(3)
|
||||||
|
.build();
|
||||||
|
}));
|
||||||
|
addRecipeEntry(new RecipeEntry("log", (material, config, id) -> {
|
||||||
|
GridRecipe.make(id, getBlock(BLOCK_LOG))
|
||||||
|
.checkConfig(config)
|
||||||
|
.setShape("##", "##")
|
||||||
|
.addMaterial('#', getBlock(BLOCK_BARK))
|
||||||
|
.setOutputCount(3)
|
||||||
|
.build();
|
||||||
|
}));
|
||||||
|
addRecipeEntry(new RecipeEntry("stripped_bark", (material, config, id) -> {
|
||||||
|
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_BARK))
|
||||||
|
.checkConfig(config)
|
||||||
|
.setShape("##", "##")
|
||||||
|
.addMaterial('#', getBlock(BLOCK_STRIPPED_LOG))
|
||||||
|
.setOutputCount(3)
|
||||||
|
.build();
|
||||||
|
}));
|
||||||
|
addRecipeEntry(new RecipeEntry("stripped_log", (material, config, id) -> {
|
||||||
|
GridRecipe.make(id, getBlock(BLOCK_STRIPPED_LOG))
|
||||||
|
.checkConfig(config)
|
||||||
|
.setShape("##", "##")
|
||||||
|
.addMaterial('#', getBlock(BLOCK_STRIPPED_BARK))
|
||||||
|
.setOutputCount(3)
|
||||||
|
.build();
|
||||||
|
}));
|
||||||
|
addRecipeEntry(new RecipeEntry("composter", (material, config, id) -> {
|
||||||
|
GridRecipe.make(id, getBlock(BLOCK_COMPOSTER))
|
||||||
|
.checkConfig(config)
|
||||||
|
.setShape("# #", "# #", "###")
|
||||||
|
.addMaterial('#', getBlock(BLOCK_SLAB))
|
||||||
|
.build();
|
||||||
|
}));
|
||||||
|
addRecipeEntry(new RecipeEntry("shulker", (material, config, id) -> {
|
||||||
|
GridRecipe.make(id, getBlock(BLOCK_COMPOSTER))
|
||||||
|
.checkConfig(config)
|
||||||
|
.setShape("S", "#", "S")
|
||||||
|
.addMaterial('S', Items.SHULKER_SHELL)
|
||||||
|
.addMaterial('#', getBlock(BLOCK_CHEST))
|
||||||
|
.build();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package ru.bclib.complexmaterials.entry;
|
||||||
|
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import ru.bclib.complexmaterials.ComplexMaterial;
|
||||||
|
import ru.bclib.config.PathConfig;
|
||||||
|
import ru.bclib.util.TriConsumer;
|
||||||
|
|
||||||
|
public class RecipeEntry extends ComplexMaterialEntry {
|
||||||
|
final TriConsumer<ComplexMaterial, PathConfig, ResourceLocation> initFunction;
|
||||||
|
|
||||||
|
public RecipeEntry(String suffix, TriConsumer<ComplexMaterial, PathConfig, ResourceLocation> initFunction) {
|
||||||
|
super(suffix);
|
||||||
|
this.initFunction = initFunction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(ComplexMaterial material, PathConfig recipeConfig) {
|
||||||
|
initFunction.accept(material, recipeConfig, getLocation(material.getModID(), material.getBaseName()));
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,9 +33,13 @@ public class GridRecipe {
|
||||||
private boolean exist = true;
|
private boolean exist = true;
|
||||||
|
|
||||||
private GridRecipe() {}
|
private GridRecipe() {}
|
||||||
|
|
||||||
public static GridRecipe make(String modID, String name, ItemLike output) {
|
public static GridRecipe make(String modID, String name, ItemLike output) {
|
||||||
INSTANCE.id = new ResourceLocation(modID, name);
|
return make(new ResourceLocation(modID, name), output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GridRecipe make(ResourceLocation id, ItemLike output) {
|
||||||
|
INSTANCE.id = id;
|
||||||
INSTANCE.output = output;
|
INSTANCE.output = output;
|
||||||
|
|
||||||
INSTANCE.group = "";
|
INSTANCE.group = "";
|
||||||
|
|
6
src/main/java/ru/bclib/util/TriConsumer.java
Normal file
6
src/main/java/ru/bclib/util/TriConsumer.java
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
package ru.bclib.util;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface TriConsumer<A, B, C> {
|
||||||
|
void accept(A a, B b, C c);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue