Improved handling of Slot-Based ComplexMaterials

This commit is contained in:
Frank 2023-05-20 18:26:27 +02:00
parent f9870d388e
commit 490ad640cd
29 changed files with 356 additions and 167 deletions

View file

@ -1,20 +1,19 @@
package org.betterx.bclib.complexmaterials; package org.betterx.bclib.complexmaterials;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot; import org.betterx.bclib.complexmaterials.entry.MaterialSlot;
import org.betterx.bclib.complexmaterials.entry.SlotMap;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.List;
public abstract class ComplexMaterialSet<M extends ComplexMaterialSet<?>> extends ComplexMaterial { public abstract class ComplexMaterialSet<M extends ComplexMaterialSet<?>> extends ComplexMaterial {
List<MaterialSlot<M>> slots; SlotMap<M> slots;
protected ComplexMaterialSet(String modID, String baseName, String receipGroupPrefix) { protected ComplexMaterialSet(String modID, String baseName, String receipGroupPrefix) {
super(modID, baseName, receipGroupPrefix); super(modID, baseName, receipGroupPrefix);
} }
protected abstract List<MaterialSlot<M>> createMaterialSlots(); protected abstract SlotMap<M> createMaterialSlots();
@Override @Override
@ -22,6 +21,7 @@ public abstract class ComplexMaterialSet<M extends ComplexMaterialSet<?>> extend
this.slots = createMaterialSlots(); this.slots = createMaterialSlots();
for (MaterialSlot<M> slot : slots) { for (MaterialSlot<M> slot : slots) {
slot.onInit((M) this);
slot.addBlockEntry((M) this, this::addBlockEntry); slot.addBlockEntry((M) this, this::addBlockEntry);
} }
for (MaterialSlot<M> slot : slots) { for (MaterialSlot<M> slot : slots) {

View file

@ -1,7 +1,7 @@
package org.betterx.bclib.complexmaterials; package org.betterx.bclib.complexmaterials;
import org.betterx.bclib.BCLib; import org.betterx.bclib.BCLib;
import org.betterx.bclib.complexmaterials.entry.MaterialSlot; import org.betterx.bclib.complexmaterials.entry.SlotMap;
import org.betterx.bclib.complexmaterials.set.wood.WoodSlots; import org.betterx.bclib.complexmaterials.set.wood.WoodSlots;
import org.betterx.bclib.items.boat.BoatTypeOverride; import org.betterx.bclib.items.boat.BoatTypeOverride;
import org.betterx.worlds.together.tag.v3.TagManager; import org.betterx.worlds.together.tag.v3.TagManager;
@ -14,7 +14,6 @@ import net.minecraft.world.level.material.MapColor;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -97,9 +96,8 @@ public class WoodenComplexMaterial extends ComplexMaterialSet<WoodenComplexMater
} }
@Override @Override
protected List<MaterialSlot<WoodenComplexMaterial>> createMaterialSlots() { protected SlotMap<WoodenComplexMaterial> createMaterialSlots() {
return SlotMap.of(
var list = List.of(
WoodSlots.STRIPPED_LOG, WoodSlots.STRIPPED_LOG,
WoodSlots.STRIPPED_BARK, WoodSlots.STRIPPED_BARK,
WoodSlots.LOG, WoodSlots.LOG,
@ -119,12 +117,8 @@ public class WoodenComplexMaterial extends ComplexMaterialSet<WoodenComplexMater
WoodSlots.BARREL, WoodSlots.BARREL,
WoodSlots.CRAFTING_TABLE, WoodSlots.CRAFTING_TABLE,
WoodSlots.BOOKSHELF, WoodSlots.BOOKSHELF,
WoodSlots.COMPOSTER, WoodSlots.COMPOSTER
WoodSlots.BOAT,
WoodSlots.CHEST_BOAT
); );
return list;
} }
@Override @Override

View file

@ -4,7 +4,6 @@ import org.betterx.bclib.complexmaterials.ComplexMaterial;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class MaterialSlot<M extends ComplexMaterial> { public abstract class MaterialSlot<M extends ComplexMaterial> {
@NotNull @NotNull
@ -18,16 +17,8 @@ public abstract class MaterialSlot<M extends ComplexMaterial> {
public abstract void addRecipeEntry(M parentMaterial, Consumer<RecipeEntry> adder); public abstract void addRecipeEntry(M parentMaterial, Consumer<RecipeEntry> adder);
public void addItemEntry(M parentMaterial, Consumer<ItemEntry> 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) { public void onInit(M parentMaterial) {
} }

View file

@ -0,0 +1,60 @@
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.function.BiFunction;
import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class SimpleBlockOnlyMaterialSlot<M extends ComplexMaterial> extends SimpleMaterialSlot<M> {
public SimpleBlockOnlyMaterialSlot(@NotNull String suffix) {
super(suffix);
}
@Override
@Nullable
protected BlockEntry getBlockEntry(M parentMaterial) {
final BlockEntry entry = new BlockEntry(suffix, false, (c, p) -> this.createBlock(parentMaterial, p));
modifyBlockEntry(parentMaterial, entry);
return entry;
}
public static <M extends ComplexMaterial> SimpleBlockOnlyMaterialSlot<M> createBlockOnly(
@NotNull String suffix,
BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> maker
) {
return new SimpleBlockOnlyMaterialSlot(suffix) {
@Override
protected @NotNull Block createBlock(ComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
return maker.apply(parentMaterial, settings);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
}
};
}
public static <M extends ComplexMaterial> SimpleBlockOnlyMaterialSlot<M> createBlockOnly(
@NotNull String suffix,
Supplier<Block> maker
) {
return new SimpleBlockOnlyMaterialSlot(suffix) {
@Override
protected @NotNull Block createBlock(ComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
return maker.get();
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
}
};
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import java.util.Objects; import java.util.Objects;
import java.util.function.BiFunction; import java.util.function.BiFunction;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,15 +25,14 @@ public abstract class SimpleMaterialSlot<M extends ComplexMaterial> extends Mate
@Nullable @Nullable
protected BlockEntry getBlockEntry(M parentMaterial) { protected BlockEntry getBlockEntry(M parentMaterial) {
var supplier = getBlockSupplier(parentMaterial); final BlockEntry entry = new BlockEntry(suffix, (c, p) -> this.createBlock(parentMaterial, p));
if (supplier != null) { modifyBlockEntry(parentMaterial, entry);
final BlockEntry entry = new BlockEntry(suffix, supplier); return entry;
modifyBlockEntry(parentMaterial, entry);
return entry;
}
return null;
} }
@NotNull
protected abstract Block createBlock(M parentMaterial, BlockBehaviour.Properties settings);
protected void modifyBlockEntry(M parentMaterial, @NotNull BlockEntry entry) { protected void modifyBlockEntry(M parentMaterial, @NotNull BlockEntry entry) {
} }
@ -41,18 +41,28 @@ public abstract class SimpleMaterialSlot<M extends ComplexMaterial> extends Mate
adder.accept(getRecipeEntry(parentMaterial)); adder.accept(getRecipeEntry(parentMaterial));
} }
@NotNull
protected abstract BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(M parentMaterial);
protected @Nullable RecipeEntry getRecipeEntry(M parentMaterial) { protected @Nullable RecipeEntry getRecipeEntry(M parentMaterial) {
return new RecipeEntry(suffix, this::getRecipeSupplier); return new RecipeEntry(suffix, this::makeRecipe);
} }
protected abstract @Nullable void getRecipeSupplier( protected abstract @Nullable void makeRecipe(
ComplexMaterial parentMaterial, ComplexMaterial parentMaterial,
ResourceLocation id ResourceLocation id
); );
@Override
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;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
@ -65,4 +75,38 @@ public abstract class SimpleMaterialSlot<M extends ComplexMaterial> extends Mate
public int hashCode() { public int hashCode() {
return Objects.hash(suffix); return Objects.hash(suffix);
} }
public static <M extends ComplexMaterial> SimpleMaterialSlot<M> createBlockItem(
@NotNull String suffix,
BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> maker
) {
return new SimpleMaterialSlot(suffix) {
@Override
protected @NotNull Block createBlock(ComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
return maker.apply(parentMaterial, settings);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
}
};
}
public static <M extends ComplexMaterial> SimpleMaterialSlot<M> createBlockItem(
@NotNull String suffix,
Supplier<Block> maker
) {
return new SimpleMaterialSlot(suffix) {
@Override
protected @NotNull Block createBlock(ComplexMaterial parentMaterial, BlockBehaviour.Properties settings) {
return maker.get();
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
}
};
}
} }

View file

@ -0,0 +1,49 @@
package org.betterx.bclib.complexmaterials.entry;
import org.betterx.bclib.complexmaterials.ComplexMaterialSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import org.jetbrains.annotations.NotNull;
public class SlotMap<M extends ComplexMaterialSet<? extends ComplexMaterialSet<?>>> implements Iterable<MaterialSlot<M>> {
private final Map<String, MaterialSlot<M>> map;
public SlotMap() {
this.map = new LinkedHashMap<>();
}
public static <M extends ComplexMaterialSet<? extends ComplexMaterialSet<?>>> SlotMap<M> of(MaterialSlot<M>... slots) {
final SlotMap<M> map = new SlotMap<>();
for (MaterialSlot<M> slot : slots) {
map.add(slot);
}
return map;
}
public SlotMap<M> replace(MaterialSlot<M> slot) {
return add(slot);
}
public SlotMap<M> add(MaterialSlot<M> slot) {
map.put(slot.suffix, slot);
return this;
}
public SlotMap<M> remove(MaterialSlot<M> slot) {
map.remove(slot.suffix);
return this;
}
public SlotMap<M> remove(String slot) {
map.remove(slot);
return this;
}
@NotNull
@Override
public Iterator<MaterialSlot<M>> iterator() {
return map.values().iterator();
}
}

View file

@ -0,0 +1,61 @@
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.SimpleMaterialSlot;
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 java.util.function.Supplier;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class AbstractSaplingSlot extends SimpleMaterialSlot<WoodenComplexMaterial> {
protected static final String SAPLING_SUFFIX = "sapling";
protected AbstractSaplingSlot() {
super(SAPLING_SUFFIX);
}
@Override
protected void modifyBlockEntry(WoodenComplexMaterial parentMaterial, @NotNull BlockEntry entry) {
entry
.setBlockTags(BlockTags.SAPLINGS)
.setItemTags(ItemTags.SAPLINGS);
}
@Override
protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
}
public static AbstractSaplingSlot create(BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> maker) {
return new AbstractSaplingSlot() {
@Override
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial,
BlockBehaviour.Properties settings
) {
return maker.apply(parentMaterial, settings);
}
};
}
public static AbstractSaplingSlot create(Supplier<Block> maker) {
return new AbstractSaplingSlot() {
@Override
protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial,
BlockBehaviour.Properties settings
) {
return maker.get();
}
};
}
}

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,12 +23,12 @@ public class Bark extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new StripableBarkBlock( return new StripableBarkBlock(
parentMaterial.woodColor, parentMaterial.woodColor,
complexMaterial.getBlock(WoodSlots.STRIPPED_BARK) parentMaterial.getBlock(WoodSlots.STRIPPED_BARK)
); );
} }
@ -50,7 +49,7 @@ public class Bark extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, material.getBlock(suffix)) .crafting(id, material.getBlock(suffix))
.setShape("##", "##") .setShape("##", "##")

View file

@ -14,7 +14,6 @@ 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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Barrel extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseBarrelBlock(complexMaterial.getBlock(WoodSlots.PLANKS)); return new BaseBarrelBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -37,7 +36,7 @@ public class Barrel extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setShape("#S#", "# #", "#S#") .setShape("#S#", "# #", "#S#")

View file

@ -9,10 +9,10 @@ import org.betterx.bclib.recipes.BCLRecipeBuilder;
import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
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 java.util.function.BiFunction;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -27,12 +27,11 @@ public class Boat extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (a, b) -> { //this should never get called
return null; return null;
};
} }
@Override @Override
@ -41,18 +40,22 @@ public class Boat extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder makeBoatRecipe(id, parentMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.getItem(suffix));
.crafting(id, parentMaterial.getBlock(suffix))
.setShape("# #", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))
.setGroup("boat")
.setCategory(RecipeCategory.TRANSPORTATION)
.build();
} }
@Override @Override
public void onInit(WoodenComplexMaterial parentMaterial) { public void onInit(WoodenComplexMaterial parentMaterial) {
parentMaterial.initBoatType(); parentMaterial.initBoatType();
} }
public static void makeBoatRecipe(ResourceLocation id, Block planks, Item boat) {
BCLRecipeBuilder
.crafting(id, boat)
.setShape("# #", "###")
.addMaterial('#', planks)
.setGroup("boat")
.setCategory(RecipeCategory.TRANSPORTATION)
.build();
}
} }

View file

@ -14,7 +14,6 @@ import net.minecraft.world.item.Items;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Bookshelf extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (cmx, settings) -> new BaseBookshelfBlock(cmx.getBlock(WoodSlots.PLANKS)); return new BaseBookshelfBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -36,7 +35,7 @@ public class Bookshelf extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setShape("###", "PPP", "###") .setShape("###", "PPP", "###")

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,11 +23,11 @@ public class Button extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseWoodenButtonBlock( return new BaseWoodenButtonBlock(
complexMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType() parentMaterial.woodType.setType()
); );
} }
@ -40,7 +39,7 @@ public class Button extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.shapeless() .shapeless()

View file

@ -14,7 +14,6 @@ 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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Chest extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseChestBlock(complexMaterial.getBlock(WoodSlots.PLANKS)); return new BaseChestBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -37,7 +36,7 @@ public class Chest extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setShape("###", "# #", "###") .setShape("###", "# #", "###")

View file

@ -12,10 +12,10 @@ import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags; import net.minecraft.tags.ItemTags;
import net.minecraft.tags.TagKey; import net.minecraft.tags.TagKey;
import net.minecraft.world.item.Item;
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 java.util.function.BiFunction;
import java.util.function.Consumer; import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -30,12 +30,11 @@ public class ChestBoat extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (a, b) -> { //this should never get called
return null; return null;
};
} }
@Override @Override
@ -47,18 +46,23 @@ public class ChestBoat extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix)) makeChestBoatRecipe(id, parentMaterial.getItem(WoodSlots.BOAT), parentMaterial.getItem(WoodSlots.CHEST_BOAT));
.shapeless()
.addMaterial('C', CommonItemTags.CHEST)
.addMaterial('#', parentMaterial.getBlock(WoodSlots.BOAT))
.setGroup("chest_boat")
.setCategory(RecipeCategory.TRANSPORTATION)
.build();
} }
@Override @Override
public void onInit(WoodenComplexMaterial parentMaterial) { public void onInit(WoodenComplexMaterial parentMaterial) {
parentMaterial.initBoatType(); parentMaterial.initBoatType();
} }
public static void makeChestBoatRecipe(ResourceLocation id, Item boat, Item chestBoat) {
BCLRecipeBuilder
.crafting(id, chestBoat)
.shapeless()
.addMaterial('C', CommonItemTags.CHEST)
.addMaterial('#', boat)
.setGroup("chest_boat")
.setCategory(RecipeCategory.TRANSPORTATION)
.build();
}
} }

View file

@ -13,7 +13,6 @@ 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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -23,10 +22,10 @@ public class Composter extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseComposterBlock(complexMaterial.getBlock(WoodSlots.PLANKS)); return new BaseComposterBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -35,7 +34,7 @@ public class Composter extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix)) BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setShape("# #", "# #", "###") .setShape("# #", "# #", "###")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.SLAB)) .addMaterial('#', parentMaterial.getBlock(WoodSlots.SLAB))

View file

@ -14,7 +14,6 @@ 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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class CraftingTable extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (cmx, settings) -> new BaseCraftingTableBlock(cmx.getBlock(WoodSlots.PLANKS)); return new BaseCraftingTableBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -37,7 +36,7 @@ public class CraftingTable extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setShape("##", "##") .setShape("##", "##")

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,11 +23,11 @@ public class Door extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseDoorBlock( return new BaseDoorBlock(
complexMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType() parentMaterial.woodType.setType()
); );
} }
@ -40,7 +39,7 @@ public class Door extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3) .setOutputCount(3)

View file

@ -15,7 +15,6 @@ import net.minecraft.world.item.Items;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -25,10 +24,10 @@ public class Fence extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseFenceBlock(complexMaterial.getBlock(WoodSlots.PLANKS)); return new BaseFenceBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -38,7 +37,7 @@ public class Fence extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3) .setOutputCount(3)

View file

@ -14,7 +14,6 @@ import net.minecraft.world.item.Items;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,11 +23,11 @@ public class Gate extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseGateBlock( return new BaseGateBlock(
complexMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.type() parentMaterial.woodType.type()
); );
} }
@ -39,7 +38,7 @@ public class Gate extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix)) BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setShape("I#I", "I#I") .setShape("I#I", "I#I")
.addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS)) .addMaterial('#', parentMaterial.getBlock(WoodSlots.PLANKS))

View file

@ -14,7 +14,6 @@ import net.minecraft.world.item.Items;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Ladder extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseLadderBlock(complexMaterial.getBlock(WoodSlots.PLANKS)); return new BaseLadderBlock(parentMaterial.getBlock(WoodSlots.PLANKS));
} }
@Override @Override
@ -36,7 +35,7 @@ public class Ladder extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(3) .setOutputCount(3)

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,12 +23,12 @@ public class Log extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseStripableLogBlock( return new BaseStripableLogBlock(
parentMaterial.woodColor, parentMaterial.woodColor,
complexMaterial.getBlock(WoodSlots.STRIPPED_LOG) parentMaterial.getBlock(WoodSlots.STRIPPED_LOG)
); );
} }
@ -49,7 +48,7 @@ public class Log extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, material.getBlock(suffix)) .crafting(id, material.getBlock(suffix))
.setShape("##", "##") .setShape("##", "##")

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Planks extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseBlock(settings); return new BaseBlock(settings);
} }
@Override @Override
@ -38,7 +37,7 @@ public class Planks extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix)) BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(4) .setOutputCount(4)
.shapeless() .shapeless()

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,11 +23,11 @@ public class PressurePlate extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new WoodenPressurePlateBlock( return new WoodenPressurePlateBlock(
complexMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType() parentMaterial.woodType.setType()
); );
} }
@ -40,7 +39,7 @@ public class PressurePlate extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setShape("##") .setShape("##")

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Slab extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseSlabBlock(complexMaterial.getBlock(WoodSlots.PLANKS), false); return new BaseSlabBlock(parentMaterial.getBlock(WoodSlots.PLANKS), false);
} }
@Override @Override
@ -37,7 +36,7 @@ public class Slab extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(6) .setOutputCount(6)

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class Stairs extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseStairsBlock(complexMaterial.getBlock(WoodSlots.PLANKS), false); return new BaseStairsBlock(parentMaterial.getBlock(WoodSlots.PLANKS), false);
} }
@Override @Override
@ -37,7 +36,7 @@ public class Stairs extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, parentMaterial.getBlock(suffix)) .crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(4) .setOutputCount(4)

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,10 +23,10 @@ public class StrippedBark extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( protected @NotNull Block createBlock(
WoodenComplexMaterial parentMaterial WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
) { ) {
return (complexMaterial, settings) -> new BaseBarkBlock(settings); return new BaseBarkBlock(settings);
} }
@Override @Override
@ -46,7 +45,7 @@ public class StrippedBark extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, material.getBlock(suffix)) .crafting(id, material.getBlock(suffix))
.setShape("##", "##") .setShape("##", "##")

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -24,9 +23,10 @@ public class StrippedLog extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
@NotNull protected @NotNull Block createBlock(
protected BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier(WoodenComplexMaterial parentMaterial) { WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
return (complexMaterial, settings) -> new BaseRotatedPillarBlock(settings); ) {
return new BaseRotatedPillarBlock(settings);
} }
@Override @Override
@ -45,7 +45,7 @@ public class StrippedLog extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial material, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial material, ResourceLocation id) {
BCLRecipeBuilder BCLRecipeBuilder
.crafting(id, material.getBlock(suffix)) .crafting(id, material.getBlock(suffix))
.setShape("##", "##") .setShape("##", "##")

View file

@ -14,7 +14,6 @@ import net.minecraft.tags.ItemTags;
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 java.util.function.BiFunction;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -23,12 +22,11 @@ public class Trapdoor extends SimpleMaterialSlot<WoodenComplexMaterial> {
super("trapdoor"); super("trapdoor");
} }
@Override protected @NotNull Block createBlock(
protected @NotNull BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> getBlockSupplier( WoodenComplexMaterial parentMaterial, BlockBehaviour.Properties settings
WoodenComplexMaterial parentMaterial
) { ) {
return (complexMaterial, settings) -> new BaseTrapdoorBlock( return new BaseTrapdoorBlock(
complexMaterial.getBlock(WoodSlots.PLANKS), parentMaterial.getBlock(WoodSlots.PLANKS),
parentMaterial.woodType.setType() parentMaterial.woodType.setType()
); );
} }
@ -40,7 +38,7 @@ public class Trapdoor extends SimpleMaterialSlot<WoodenComplexMaterial> {
} }
@Override @Override
protected @Nullable void getRecipeSupplier(ComplexMaterial parentMaterial, ResourceLocation id) { protected @Nullable void makeRecipe(ComplexMaterial parentMaterial, ResourceLocation id) {
BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix)) BCLRecipeBuilder.crafting(id, parentMaterial.getBlock(suffix))
.setOutputCount(2) .setOutputCount(2)
.setShape("###", "###") .setShape("###", "###")

View file

@ -19,7 +19,6 @@ public class WoodSlots {
public static final MaterialSlot<WoodenComplexMaterial> DOOR = new Door(); public static final MaterialSlot<WoodenComplexMaterial> DOOR = new Door();
public static final MaterialSlot<WoodenComplexMaterial> LADDER = new Ladder(); public static final MaterialSlot<WoodenComplexMaterial> LADDER = new Ladder();
public static final Sign SIGN = new Sign(); 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> CHEST = new Chest();
public static final MaterialSlot<WoodenComplexMaterial> BARREL = new Barrel(); public static final MaterialSlot<WoodenComplexMaterial> BARREL = new Barrel();
public static final MaterialSlot<WoodenComplexMaterial> CRAFTING_TABLE = new CraftingTable(); public static final MaterialSlot<WoodenComplexMaterial> CRAFTING_TABLE = new CraftingTable();
@ -27,6 +26,9 @@ public class WoodSlots {
public static final MaterialSlot<WoodenComplexMaterial> COMPOSTER = new Composter(); public static final MaterialSlot<WoodenComplexMaterial> COMPOSTER = new Composter();
public static final MaterialSlot<WoodenComplexMaterial> BOAT = new Boat(); public static final MaterialSlot<WoodenComplexMaterial> BOAT = new Boat();
public static final MaterialSlot<WoodenComplexMaterial> CHEST_BOAT = new ChestBoat(); public static final MaterialSlot<WoodenComplexMaterial> CHEST_BOAT = new ChestBoat();
public static final String WALL_SIGN = Sign.WALL_SUFFFIX;
public static final String SAPLING = AbstractSaplingSlot.SAPLING_SUFFIX;
} }