Skip to content

Commit 7758114

Browse files
committed
ElectricJuicer
Suggestion #2560 discord
1 parent b841828 commit 7758114

File tree

4 files changed

+67
-0
lines changed

4 files changed

+67
-0
lines changed

src/main/java/io/github/thebusybiscuit/slimefun4/implementation/SlimefunItems.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,7 @@ private SlimefunItems() {}
586586
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");
587587
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)");
588588
public static final SlimefunItemStack JUICER = new SlimefunItemStack("JUICER", Material.GLASS_BOTTLE, "&aJuicer", "", "&aAllows you to create delicious Juice");
589+
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));
589590
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.");
590591

591592
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.");
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines;
2+
3+
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
4+
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
5+
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
6+
import io.github.thebusybiscuit.slimefun4.core.attributes.RecipeDisplayItem;
7+
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.AContainer;
8+
import org.bukkit.Material;
9+
import org.bukkit.inventory.ItemStack;
10+
11+
import javax.annotation.Nonnull;
12+
13+
public class ElectricJuicer extends AContainer implements RecipeDisplayItem {
14+
public ElectricJuicer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
15+
super(itemGroup, item, recipeType, recipe);
16+
}
17+
18+
@Override
19+
public ItemStack getProgressBar() {
20+
return new ItemStack(Material.DIAMOND_SHOVEL);
21+
}
22+
23+
@Nonnull
24+
@Override
25+
public String getMachineIdentifier() {
26+
return "ELECTRIC_JUICER";
27+
}
28+
}

src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import javax.annotation.Nonnull;
1818

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

8384
loadOreGrinderRecipes();
8485
loadSmelteryRecipes();
86+
loadJuicer();
8587

8688
CommandSender sender = Bukkit.getConsoleSender();
8789

@@ -206,6 +208,34 @@ private static void loadSmelteryRecipes() {
206208
}
207209
}
208210

211+
private static void loadJuicer() {
212+
List<ItemStack[]> juicerRecipes = new ArrayList<>();
213+
214+
Juicer juicer = (Juicer) SlimefunItems.JUICER.getItem();
215+
if (juicer == null) {
216+
return;
217+
}
218+
219+
ItemStack[] input = null;
220+
221+
for (ItemStack[] recipe : juicer.getRecipes()) {
222+
223+
if (input == null) {
224+
input = recipe;
225+
continue;
226+
}
227+
228+
if (input[0] != null && recipe[0] != null) {
229+
juicerRecipes.add(new ItemStack[] { input[0], recipe[0] });
230+
}
231+
232+
input = null;
233+
}
234+
235+
Stream<ItemStack[]> stream = juicerRecipes.stream();
236+
stream.forEach(recipe -> registerMachineRecipe("ELECTRIC_JUICER", 2, new ItemStack[] { recipe[0] }, new ItemStack[] { recipe[1] }));
237+
}
238+
209239
private static void addSmelteryRecipe(ItemStack[] input, ItemStack[] output, MakeshiftSmeltery makeshiftSmeltery) {
210240
List<ItemStack> ingredients = new ArrayList<>();
211241

src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/SlimefunItemSetup.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import javax.annotation.Nonnull;
77
import javax.annotation.ParametersAreNonnullByDefault;
88

9+
import io.github.thebusybiscuit.slimefun4.implementation.items.electric.machines.ElectricJuicer;
910
import org.bukkit.DyeColor;
1011
import org.bukkit.Material;
1112
import org.bukkit.NamespacedKey;
@@ -2321,6 +2322,13 @@ public int getEnergyConsumption() {
23212322
new SlimefunItemStack(SlimefunItems.ELEVATOR_PLATE, 2))
23222323
.register(plugin);
23232324

2325+
new ElectricJuicer(itemGroups.electricity, SlimefunItems.ELECTRIC_JUICER, RecipeType.ENHANCED_CRAFTING_TABLE,
2326+
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)})
2327+
.setCapacity(128)
2328+
.setEnergyConsumption(5)
2329+
.setProcessingSpeed(1)
2330+
.register(plugin);
2331+
23242332
new FoodFabricator(itemGroups.electricity, SlimefunItems.FOOD_FABRICATOR, RecipeType.ENHANCED_CRAFTING_TABLE,
23252333
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})
23262334
.setCapacity(256)

0 commit comments

Comments
 (0)