mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Refactor + undo placeholder item in displayrecipes
This commit is contained in:
parent
37242fe64a
commit
e6ed632dd0
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.item.CustomItem;
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -52,11 +51,11 @@ public class TableSaw extends MultiBlockMachine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomItem ci = new CustomItem(Material.OAK_PLANKS, "Any Wooden Plank");
|
for (Material plank : Tag.PLANKS.getValues()) {
|
||||||
|
displayedRecipes.add(new ItemStack(plank));
|
||||||
displayedRecipes.add(new ItemStack(ci));
|
|
||||||
displayedRecipes.add(new ItemStack(Material.STICK, 4));
|
displayedRecipes.add(new ItemStack(Material.STICK, 4));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDisplayRecipes() {
|
public List<ItemStack> getDisplayRecipes() {
|
||||||
@ -66,7 +65,7 @@ public class TableSaw extends MultiBlockMachine {
|
|||||||
@Override
|
@Override
|
||||||
public void onInteract(@Nonnull Player p, @Nonnull Block b) {
|
public void onInteract(@Nonnull Player p, @Nonnull Block b) {
|
||||||
ItemStack item = p.getInventory().getItemInMainHand();
|
ItemStack item = p.getInventory().getItemInMainHand();
|
||||||
ItemStack output = getItemsToOutput(item);
|
ItemStack output = getItemsToOutput(item.getType());
|
||||||
|
|
||||||
if (output == null) {
|
if (output == null) {
|
||||||
return;
|
return;
|
||||||
@ -81,12 +80,12 @@ public class TableSaw extends MultiBlockMachine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private ItemStack getItemsToOutput(@Nonnull ItemStack item) {
|
private ItemStack getItemsToOutput(@Nonnull Material item) {
|
||||||
if (Tag.LOGS.isTagged(item.getType())) {
|
if (Tag.LOGS.isTagged(item)) {
|
||||||
Optional<Material> planks = MaterialConverter.getPlanksFromLog(item.getType());
|
Optional<Material> planks = MaterialConverter.getPlanksFromLog(item);
|
||||||
return new ItemStack(planks.get(), 8);
|
return new ItemStack(planks.get(), 8);
|
||||||
}
|
}
|
||||||
else if (Tag.PLANKS.isTagged(item.getType())) {
|
else if (Tag.PLANKS.isTagged(item)) {
|
||||||
return new ItemStack(Material.STICK, 4);
|
return new ItemStack(Material.STICK, 4);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user