Skip to content

Commit

Permalink
ElectricJuicer
Browse files Browse the repository at this point in the history
Suggestion #2560 discord
  • Loading branch information
Intybyte committed May 16, 2024
1 parent b841828 commit 7758114
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ private SlimefunItems() {}
public static final SlimefunItemStack ORE_WASHER = new SlimefunItemStack("ORE_WASHER", Material.CAULDRON, "&6Ore Washer", "", "&aWashes Sifted Ore to filter Ores", "&aand gives you small Stone Chunks");
public static final SlimefunItemStack TABLE_SAW = new SlimefunItemStack("TABLE_SAW", Material.STONECUTTER, "&6Table Saw", "", "&aAllows you to get 8 planks from 1 Log", "&a(Works with all log types)");
public static final SlimefunItemStack JUICER = new SlimefunItemStack("JUICER", Material.GLASS_BOTTLE, "&aJuicer", "", "&aAllows you to create delicious Juice");
public static final SlimefunItemStack ELECTRIC_JUICER = new SlimefunItemStack("ELECTRIC_JUICER", Material.TINTED_GLASS, "&aElectric Juicer", "", "&aAllows you to create delicious Juice", "", LoreBuilder.machine(MachineTier.BASIC, MachineType.MACHINE), LoreBuilder.powerBuffer(128), LoreBuilder.powerPerSecond(10));
public static final SlimefunItemStack AUTOMATED_PANNING_MACHINE = new SlimefunItemStack("AUTOMATED_PANNING_MACHINE", Material.BOWL, "&eAutomated Panning Machine", "", "&fA MultiBlock Version of the Gold Pan", "&fand Nether Gold Pan combined in one machine.");

public static final SlimefunItemStack INDUSTRIAL_MINER = new SlimefunItemStack("INDUSTRIAL_MINER", Material.GOLDEN_PICKAXE, "&bIndustrial Miner", "", "&fThis Multiblock will mine any Ores", "&fin a 7x7 area underneath it.", "&fPlace coal or similar in its chest", "&fto fuel this machine.");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;

import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;

import javax.annotation.Nonnull;

public class ElectricJuicer extends AContainer implements RecipeDisplayItem {
public ElectricJuicer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
super(itemGroup, item, recipeType, recipe);
}

@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.DIAMOND_SHOVEL);
}

@Nonnull
@Override
public String getMachineIdentifier() {
return "ELECTRIC_JUICER";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.annotation.Nonnull;

import io.github.thebusybiscuit.slimefun4.implementation.items.multiblocks.Juicer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -82,6 +83,7 @@ public static void loadItems() {

loadOreGrinderRecipes();
loadSmelteryRecipes();
loadJuicer();

CommandSender sender = Bukkit.getConsoleSender();

Expand Down Expand Up @@ -206,6 +208,34 @@ private static void loadSmelteryRecipes() {
}
}

private static void loadJuicer() {
List<ItemStack[]> juicerRecipes = new ArrayList<>();

Juicer juicer = (Juicer) SlimefunItems.JUICER.getItem();
if (juicer == null) {
return;
}

ItemStack[] input = null;

for (ItemStack[] recipe : juicer.getRecipes()) {

if (input == null) {
input = recipe;
continue;
}

if (input[0] != null && recipe[0] != null) {
juicerRecipes.add(new ItemStack[] { input[0], recipe[0] });
}

input = null;
}

Stream<ItemStack[]> stream = juicerRecipes.stream();
stream.forEach(recipe -> registerMachineRecipe("ELECTRIC_JUICER", 2, new ItemStack[] { recipe[0] }, new ItemStack[] { recipe[1] }));
}

private static void addSmelteryRecipe(ItemStack[] input, ItemStack[] output, MakeshiftSmeltery makeshiftSmeltery) {
List<ItemStack> ingredients = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;

import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ElectricJuicer;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
Expand Down Expand Up @@ -2321,6 +2322,13 @@ public int getEnergyConsumption() {
new SlimefunItemStack(SlimefunItems.ELEVATOR_PLATE, 2))
.register(plugin);

new ElectricJuicer(itemGroups.electricity, SlimefunItems.ELECTRIC_JUICER, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[]{ null, new ItemStack(Material.GLASS), null, SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.NETHER_BRICK_FENCE), SlimefunItems.ELECTRIC_MOTOR, new ItemStack(Material.NETHER_BRICKS), SlimefunItems.SMALL_CAPACITOR, new ItemStack(Material.NETHER_BRICKS)})
.setCapacity(128)
.setEnergyConsumption(5)
.setProcessingSpeed(1)
.register(plugin);

new FoodFabricator(itemGroups.electricity, SlimefunItems.FOOD_FABRICATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
new ItemStack[] {SlimefunItems.BILLON_INGOT, SlimefunItems.SILVER_INGOT, SlimefunItems.BILLON_INGOT, SlimefunItems.TIN_CAN, SlimefunItems.SMALL_CAPACITOR, SlimefunItems.TIN_CAN, null, SlimefunItems.ELECTRIC_MOTOR, null})
.setCapacity(256)
Expand Down

0 comments on commit 7758114

Please sign in to comment.