From c8c9a35b6af352a6bf4be8a2b47ea4182d72e71d Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sat, 17 Jul 2021 19:18:53 +0200 Subject: [PATCH] Fixed Table Saw --- .../implementation/items/multiblocks/TableSaw.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java index d7819b5f8..7af545e01 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/multiblocks/TableSaw.java @@ -6,6 +6,7 @@ import java.util.Optional; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; import org.bukkit.Effect; import org.bukkit.GameMode; @@ -32,6 +33,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.OutputChes * * @author dniym * @author svr333 + * @author TheBusyBiscuit * * @see MultiBlockMachine * @@ -40,8 +42,9 @@ public class TableSaw extends MultiBlockMachine { private final List displayedRecipes = new ArrayList<>(); - public TableSaw(ItemGroup category, SlimefunItemStack item) { - super(category, item, new ItemStack[] { null, null, null, new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB), null, new ItemStack(Material.IRON_BLOCK), null }, BlockFace.SELF); + @ParametersAreNonnullByDefault + public TableSaw(ItemGroup group, SlimefunItemStack item) { + super(group, item, new ItemStack[] { null, null, null, new ItemStack(Material.SMOOTH_STONE_SLAB), new ItemStack(Material.STONECUTTER), new ItemStack(Material.SMOOTH_STONE_SLAB), null, new ItemStack(Material.IRON_BLOCK), null }, BlockFace.SELF); for (Material log : Tag.LOGS.getValues()) { Optional planks = getPlanks(log); @@ -59,8 +62,9 @@ public class TableSaw extends MultiBlockMachine { } private @Nonnull Optional getPlanks(@Nonnull Material log) { - // TODO: Return plank for corresponding log - return Optional.empty(); + String materialName = log.name().replace("STRIPPED_", ""); + materialName = materialName.substring(0, materialName.lastIndexOf('_')) + "_PLANKS"; + return Optional.ofNullable(Material.getMaterial(materialName)); } @Override