Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added bamboo to the saw table #3878

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
import io.github.bakedlibs.dough.items.ItemUtils;
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.MinecraftVersion;
import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.OutputChest;

/**
* The {@link TableSaw} is an implementation of a {@link MultiBlockMachine} that allows
* you to turn Logs into Wooden Planks.
*
* <p>
* It also replaced the old "Saw Mill" from earlier versions.
*
* @author dniym
Expand Down Expand Up @@ -60,11 +61,22 @@ null, new ItemStack(Material.IRON_BLOCK), null
displayedRecipes.add(new ItemStack(planks.get(), 8));
}
}

if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20)) {
// Bamboo blocks to Bamboo planks
displayedRecipes.add(new ItemStack(Material.BAMBOO_BLOCK));
displayedRecipes.add(new ItemStack(Material.BAMBOO_PLANKS, 4));

// Stripped Bamboo Blocks to Bamboo planks
displayedRecipes.add(new ItemStack(Material.STRIPPED_BAMBOO_BLOCK));
displayedRecipes.add(new ItemStack(Material.BAMBOO_PLANKS, 4));
}
J3fftw1 marked this conversation as resolved.
Show resolved Hide resolved

for (Material plank : Tag.PLANKS.getValues()) {
displayedRecipes.add(new ItemStack(plank));
displayedRecipes.add(new ItemStack(Material.STICK, 4));
}

}

/**
Expand Down Expand Up @@ -93,7 +105,7 @@ null, new ItemStack(Material.IRON_BLOCK), null
}

@Override
public List<ItemStack> getDisplayRecipes() {
public @Nonnull List<ItemStack> getDisplayRecipes() {
return displayedRecipes;
}

Expand All @@ -119,13 +131,11 @@ public void onInteract(@Nonnull Player p, @Nonnull Block b) {
if (Tag.LOGS.isTagged(item)) {
Optional<Material> planks = getPlanks(item);

if (planks.isPresent()) {
return new ItemStack(planks.get(), 8);
} else {
return null;
}
return planks.map(material -> new ItemStack(material, 8)).orElse(null);
} else if (Tag.PLANKS.isTagged(item)) {
return new ItemStack(Material.STICK, 4);
} else if (Tag.BAMBOO_BLOCKS.isTagged(item)) {
return new ItemStack(Material.BAMBOO_PLANKS, 4);
} else {
return null;
}
Expand Down