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

SlimefunItemStack reimplementation #4251

Open
wants to merge 53 commits into
base: walshy/mc-1.21
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6f2f30d
Fix tests
Intybyte Oct 22, 2024
a62ecff
Use delegation... this is gonna be a long pr
Intybyte Oct 22, 2024
75d9c75
Address review
Intybyte Oct 23, 2024
c8efc79
Refactor some more stuff
Intybyte Oct 23, 2024
70c96e0
More fixed, most notably ChestMenuUtils
Intybyte Oct 25, 2024
e7aefc6
More refactoring
Intybyte Oct 25, 2024
b646376
Refactor getDelegate to item, and some small changes
Intybyte Nov 4, 2024
787851c
Merge branch 'refs/heads/walshy/mc-1.21' into walshy/mc-1.21-sfi
Intybyte Nov 9, 2024
35396d0
Small error on merge
Intybyte Nov 9, 2024
dfa4e94
Merge fixes + more fixes
Intybyte Nov 9, 2024
3435390
GrindStone fix
Intybyte Nov 9, 2024
3512cd3
MagicEyeOfEnder fix
Intybyte Nov 9, 2024
af27545
NetherStarReactor fix
Intybyte Nov 9, 2024
1b73f98
NuclearReactor fix
Intybyte Nov 9, 2024
1f28097
OilPump fix
Intybyte Nov 9, 2024
cc45f7d
OreCrusher fix
Intybyte Nov 9, 2024
5e25492
OrganicFertilizer fix
Intybyte Nov 9, 2024
8969397
OrganicFood fix
Intybyte Nov 9, 2024
3497af0
TreeGrowthAccelerator fix
Intybyte Nov 9, 2024
7749d43
Add method for SlimefunItemStack
Intybyte Nov 9, 2024
69ecf93
Smeltery Fix
Intybyte Nov 9, 2024
810ad17
Smeltery Fix
Intybyte Nov 9, 2024
a5094b1
SlimefunItemInteractListener Fix
Intybyte Nov 9, 2024
5d1952d
SaltResource Fix
Intybyte Nov 9, 2024
e10da88
Yes. I wrote a parser just for this.
Intybyte Nov 10, 2024
8c25fff
Couldn't write a parser for the finishing touches tho...
Intybyte Nov 10, 2024
a85442f
Fix slimefunItem + TODO
Intybyte Nov 12, 2024
e94b355
Fix RecipeType
Intybyte Nov 12, 2024
64c5e67
Fix AncientAltarListener
Intybyte Nov 12, 2024
e0e850b
Fix ArmorTask
Intybyte Nov 12, 2024
81c600d
Fix DeathpointListener
Intybyte Nov 12, 2024
8d940bd
Fix DefaultItemGroups
Intybyte Nov 12, 2024
45d3231
Fix GadgetsListener
Intybyte Nov 12, 2024
0cd88ca
Fix Resources
Intybyte Nov 12, 2024
e141d41
Fix Resources 2
Intybyte Nov 12, 2024
eec08ce
Fix SlimefunUtils
Intybyte Nov 12, 2024
ff3b5ec
Fix Some tests to call .item();
Intybyte Nov 12, 2024
b013127
Ok lets fire those tests
Intybyte Nov 12, 2024
f409400
Forgot those
Intybyte Nov 12, 2024
2683be5
Looks like there is no reason to keep that there
Intybyte Nov 12, 2024
f4c0864
TODOs
Intybyte Nov 12, 2024
861d303
SlimefunItemStack can't be casted to ItemStack anymore
Intybyte Nov 12, 2024
26b5a43
Fix null throwing
Intybyte Nov 12, 2024
60f183b
Fix init
Intybyte Nov 12, 2024
9ff36e5
Delombok, convert to equivalent without new dependency
Intybyte Nov 16, 2024
16260d6
Fixed soulbound testing
Intybyte Nov 16, 2024
415f690
Use cloneItem here
Intybyte Nov 16, 2024
3c1d8fd
.item() and getItem() now creates a defensive copy
Intybyte Nov 16, 2024
52c80c8
Fix RecipeType
Intybyte Nov 23, 2024
8214370
Merge branch 'refs/heads/walshy/mc-1.21' into walshy/mc-1.21-sfi
Intybyte Nov 23, 2024
c8f9181
Remove unused code
Intybyte Nov 25, 2024
25da22e
1.21.3 Bundles aren't allowed
Intybyte Nov 30, 2024
84a5bbc
Required false
Intybyte Nov 30, 2024
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
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@
<dependency>
<groupId>com.github.MockBukkit</groupId>
<artifactId>MockBukkit</artifactId>
<version>v3.130.2</version>
<version>v3.133.2</version>
<scope>test</scope>

<exclusions>
Expand All @@ -410,6 +410,13 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Intybyte marked this conversation as resolved.
Show resolved Hide resolved
<version>1.18.32</version>
<scope>provided</scope>
</dependency>

<!-- Third party plugin integrations / soft dependencies -->
<dependency>
<groupId>com.sk89q.worldedit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public SlimefunItem(ItemGroup itemGroup, SlimefunItemStack item, RecipeType reci
Validate.notNull(recipeType, "'recipeType' is not allowed to be null!");

this.itemGroup = itemGroup;
this.itemStackTemplate = item;
this.itemStackTemplate = item.getDelegate();
this.id = item.getItemId();
this.recipeType = recipeType;
this.recipe = recipe;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import lombok.experimental.Delegate;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Color;
Expand Down Expand Up @@ -41,7 +42,10 @@
* @author Walshy
*
*/
public class SlimefunItemStack extends ItemStack {
public class SlimefunItemStack {

@Delegate
private ItemStack delegate;

private String id;
private ItemMetaSnapshot itemMetaSnapshot;
Expand All @@ -50,7 +54,7 @@ public class SlimefunItemStack extends ItemStack {
private String texture = null;

public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) {
super(item);
delegate = new ItemStack(item);

Validate.notNull(id, "The Item id must never be null!");
Validate.isTrue(id.equals(id.toUpperCase(Locale.ROOT)), "Slimefun Item Ids must be uppercase! (e.g. 'MY_ITEM_ID')");
Expand All @@ -61,7 +65,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) {

this.id = id;

ItemMeta meta = getItemMeta();
ItemMeta meta = delegate.getItemMeta();

Slimefun.getItemDataService().setItemData(meta, id);
Slimefun.getItemTextureService().setTexture(meta, id);
Expand All @@ -72,7 +76,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) {
public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item, @Nonnull Consumer<ItemMeta> consumer) {
this(id, item);

ItemMeta im = getItemMeta();
ItemMeta im = delegate.getItemMeta();
consumer.accept(im);
setItemMeta(im);
}
Expand Down Expand Up @@ -166,7 +170,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull Color color, @Nonnull Poti
}

public SlimefunItemStack(@Nonnull SlimefunItemStack item, int amount) {
this(item.getItemId(), item);
this(item.getItemId(), item.getDelegate());
setAmount(amount);
}

Expand Down Expand Up @@ -239,24 +243,21 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull String texture, @Nonnull C
return itemMetaSnapshot;
}

@Override
public boolean setItemMeta(ItemMeta meta) {
validate();
itemMetaSnapshot = new ItemMetaSnapshot(meta);

return super.setItemMeta(meta);
return delegate.setItemMeta(meta);
}

@Override
public void setType(Material type) {
validate();
super.setType(type);
delegate.setType(type);
}

@Override
public void setAmount(int amount) {
validate();
super.setAmount(amount);
delegate.setAmount(amount);
}

private void validate() {
Expand Down Expand Up @@ -306,13 +307,13 @@ public void lock() {
}

@Override
public ItemStack clone() {
Intybyte marked this conversation as resolved.
Show resolved Hide resolved
return new SlimefunItemStack(id, super.clone());
public SlimefunItemStack clone() {
return new SlimefunItemStack(id, delegate.clone());
}

@Override
public String toString() {
return "SlimefunItemStack (" + id + (getAmount() > 1 ? (" x " + getAmount()) : "") + ')';
return "SlimefunItemStack (" + id + (delegate.getAmount() > 1 ? (" x " + delegate.getAmount()) : "") + ')';
}

/**
Expand All @@ -332,4 +333,8 @@ public final int hashCode() {
// We don't want people to override this, it should use the super method
return super.hashCode();
}

public ItemStack getDelegate() {
Intybyte marked this conversation as resolved.
Show resolved Hide resolved
return delegate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class RecipeType implements Keyed {
public static final RecipeType ENHANCED_CRAFTING_TABLE = new RecipeType(new NamespacedKey(Slimefun.instance(), "enhanced_crafting_table"), SlimefunItems.ENHANCED_CRAFTING_TABLE, "", "&a&oA regular Crafting Table cannot", "&a&ohold this massive Amount of Power...");
public static final RecipeType JUICER = new RecipeType(new NamespacedKey(Slimefun.instance(), "juicer"), SlimefunItems.JUICER, "", "&a&oUsed for Juice Creation");

public static final RecipeType ANCIENT_ALTAR = new RecipeType(new NamespacedKey(Slimefun.instance(), "ancient_altar"), SlimefunItems.ANCIENT_ALTAR, (recipe, output) -> {
public static final RecipeType ANCIENT_ALTAR = new RecipeType(new NamespacedKey(Slimefun.instance(), "ancient_altar"), SlimefunItems.ANCIENT_ALTAR.getDelegate(), (recipe, output) -> {
AltarRecipe altarRecipe = new AltarRecipe(Arrays.asList(recipe), output);
AncientAltar altar = ((AncientAltar) SlimefunItems.ANCIENT_ALTAR.getItem());
altar.getRecipes().add(altarRecipe);
Expand Down Expand Up @@ -91,7 +91,7 @@ public RecipeType(ItemStack item, String machine) {
}

public RecipeType(NamespacedKey key, SlimefunItemStack slimefunItem, String... lore) {
this(key, slimefunItem, null, lore);
this(key, slimefunItem.getDelegate(), null, lore);
}

public RecipeType(NamespacedKey key, ItemStack item, BiConsumer<ItemStack[], ItemStack> callback, String... lore) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void onExecute(CommandSender sender, String[] args) {
}

Slimefun.runSync(() -> {
ItemStack item = SlimefunItems.RESTORED_BACKPACK.clone();
ItemStack item = SlimefunItems.RESTORED_BACKPACK.clone().getDelegate();
Intybyte marked this conversation as resolved.
Show resolved Hide resolved
Slimefun.getBackpackListener().setBackpackId(backpackOwner, item, 2, id);
player.getInventory().addItem(item);
Slimefun.getLocalization().sendMessage(sender, "commands.backpack.restored-backpack-given");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DebugFishCommand extends SubCommand {
@Override
public void onExecute(CommandSender sender, String[] args) {
if (sender instanceof Player player && sender.hasPermission("slimefun.debugging")) {
player.getInventory().addItem(SlimefunItems.DEBUG_FISH.clone());
player.getInventory().addItem(SlimefunItems.DEBUG_FISH.clone().getDelegate());
} else {
Slimefun.getLocalization().sendMessage(sender, "messages.no-permission", true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected void registerDefaultFuelTypes() {
registerFuel(new MachineFuel(4, new ItemStack(Material.SHROOMLIGHT)));
registerFuel(new MachineFuel(2, new ItemStack(Material.CRIMSON_FUNGUS)));
registerFuel(new MachineFuel(2, new ItemStack(Material.WARPED_FUNGUS)));
registerFuel(new MachineFuel(16, SlimefunItems.STRANGE_NETHER_GOO));
registerFuel(new MachineFuel(16, SlimefunItems.STRANGE_NETHER_GOO.getDelegate()));

if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) {
registerFuel(new MachineFuel(2, new ItemStack(Material.GLOW_BERRIES)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public CombustionGenerator(ItemGroup itemGroup, SlimefunItemStack item, RecipeTy

@Override
protected void registerDefaultFuelTypes() {
registerFuel(new MachineFuel(30, SlimefunItems.OIL_BUCKET));
registerFuel(new MachineFuel(90, SlimefunItems.FUEL_BUCKET));
registerFuel(new MachineFuel(30, SlimefunItems.OIL_BUCKET.getDelegate()));
registerFuel(new MachineFuel(90, SlimefunItems.FUEL_BUCKET.getDelegate()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected MachineRecipe findNextRecipe(BlockMenu menu) {
ItemStack item = menu.getItemInSlot(slot);

if (item != null && item.getType().getMaxDurability() > 0 && ((Damageable) item.getItemMeta()).getDamage() > 0) {
if (SlimefunUtils.isItemSimilar(ductTape, SlimefunItems.DUCT_TAPE, true, false)) {
if (SlimefunUtils.isItemSimilar(ductTape, SlimefunItems.DUCT_TAPE.getDelegate(), true, false)) {
ItemStack repairedItem = repair(item);

if (!menu.fits(repairedItem, getOutputSlots())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,25 @@ protected void registerDefaultRecipes() {
recipeList.add(new ItemStack(Material.BUCKET));

recipeList.add(new ItemStack(Material.COOKED_BEEF));
recipeList.add(SlimefunItems.BEEF_JERKY);
recipeList.add(SlimefunItems.BEEF_JERKY.getDelegate());

recipeList.add(new ItemStack(Material.COOKED_PORKCHOP));
recipeList.add(SlimefunItems.PORK_JERKY);
recipeList.add(SlimefunItems.PORK_JERKY.getDelegate());

recipeList.add(new ItemStack(Material.COOKED_CHICKEN));
recipeList.add(SlimefunItems.CHICKEN_JERKY);
recipeList.add(SlimefunItems.CHICKEN_JERKY.getDelegate());

recipeList.add(new ItemStack(Material.COOKED_MUTTON));
recipeList.add(SlimefunItems.MUTTON_JERKY);
recipeList.add(SlimefunItems.MUTTON_JERKY.getDelegate());

recipeList.add(new ItemStack(Material.COOKED_RABBIT));
recipeList.add(SlimefunItems.RABBIT_JERKY);
recipeList.add(SlimefunItems.RABBIT_JERKY.getDelegate());

recipeList.add(new ItemStack(Material.COOKED_COD));
recipeList.add(SlimefunItems.FISH_JERKY);
recipeList.add(SlimefunItems.FISH_JERKY.getDelegate());

recipeList.add(new ItemStack(Material.COOKED_SALMON));
recipeList.add(SlimefunItems.FISH_JERKY);
recipeList.add(SlimefunItems.FISH_JERKY.getDelegate());

if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_19)) {
recipeList.add(new ItemStack(Material.MUD));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public CarbonPress(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recip
@Override
protected void registerDefaultRecipes() {
registerRecipe(15, new ItemStack[] { new ItemStack(Material.CHARCOAL, 4) }, new ItemStack[] { new ItemStack(Material.COAL) });
registerRecipe(20, new ItemStack[] { new ItemStack(Material.COAL, 8) }, new ItemStack[] { SlimefunItems.CARBON });
registerRecipe(180, new ItemStack[] { new ItemStack(Material.COAL_BLOCK, 8) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.CARBON, 9) });
registerRecipe(30, new ItemStack[] { new CustomItemStack(SlimefunItems.CARBON, 4) }, new ItemStack[] { SlimefunItems.COMPRESSED_CARBON });
registerRecipe(60, new ItemStack[] { SlimefunItems.CARBON_CHUNK, SlimefunItems.SYNTHETIC_DIAMOND }, new ItemStack[] { SlimefunItems.RAW_CARBONADO });
registerRecipe(60, new ItemStack[] { SlimefunItems.CARBON_CHUNK }, new ItemStack[] { SlimefunItems.SYNTHETIC_DIAMOND });
registerRecipe(90, new ItemStack[] { SlimefunItems.RAW_CARBONADO }, new ItemStack[] { SlimefunItems.CARBONADO });
registerRecipe(20, new ItemStack[] { new ItemStack(Material.COAL, 8) }, new ItemStack[] { SlimefunItems.CARBON.getDelegate() });
registerRecipe(180, new ItemStack[] { new ItemStack(Material.COAL_BLOCK, 8) }, new ItemStack[] { new SlimefunItemStack(SlimefunItems.CARBON, 9).getDelegate() });
registerRecipe(30, new ItemStack[] { new CustomItemStack(SlimefunItems.CARBON.getDelegate(), 4) }, new ItemStack[] { SlimefunItems.COMPRESSED_CARBON.getDelegate() });
registerRecipe(60, new ItemStack[] { SlimefunItems.CARBON_CHUNK.getDelegate(), SlimefunItems.SYNTHETIC_DIAMOND.getDelegate() }, new ItemStack[] { SlimefunItems.RAW_CARBONADO.getDelegate() });
registerRecipe(60, new ItemStack[] { SlimefunItems.CARBON_CHUNK.getDelegate() }, new ItemStack[] { SlimefunItems.SYNTHETIC_DIAMOND.getDelegate() });
registerRecipe(90, new ItemStack[] { SlimefunItems.RAW_CARBONADO.getDelegate() }, new ItemStack[] { SlimefunItems.CARBONADO.getDelegate() });
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ protected MachineRecipe findNextRecipe(BlockMenu menu) {
for (int slot : getInputSlots()) {
ItemStack input = menu.getItemInSlot(slot);
MachineRecipe recipe = null;
if (SlimefunUtils.isItemSimilar(input, SlimefunItems.SIFTED_ORE, true, false)) {
if (SlimefunUtils.isItemSimilar(input, SlimefunItems.SIFTED_ORE.getDelegate(), true, false)) {
if (!legacyMode && !hasFreeSlot(menu)) {
return null;
}

recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.SIFTED_ORE }, new ItemStack[] { oreWasher.getRandomDust() });
recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.SIFTED_ORE.getDelegate() }, new ItemStack[] { oreWasher.getRandomDust() });

if (!legacyMode || menu.fits(recipe.getOutput()[0], getOutputSlots())) {
menu.consumeItem(slot);
return recipe;
}
} else if (SlimefunUtils.isItemSimilar(input, SlimefunItems.PULVERIZED_ORE, true)) {
recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.PULVERIZED_ORE }, new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER });
} else if (SlimefunUtils.isItemSimilar(input, SlimefunItems.PULVERIZED_ORE.getDelegate(), true)) {
recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { SlimefunItems.PULVERIZED_ORE.getDelegate() }, new ItemStack[] { SlimefunItems.PURE_ORE_CLUSTER.getDelegate() });
} else if (SlimefunUtils.isItemSimilar(input, new ItemStack(Material.SAND), true)) {
recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { new ItemStack(Material.SAND) }, new ItemStack[] { SlimefunItems.SALT });
recipe = new MachineRecipe(4 / getSpeed(), new ItemStack[] { new ItemStack(Material.SAND) }, new ItemStack[] { SlimefunItems.SALT.getDelegate() });
}

if (recipe != null && menu.fits(recipe.getOutput()[0], getOutputSlots())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public List<ItemStack> getDisplayRecipes() {
protected void registerDefaultRecipes() {
// this is an extra recipe on top of PostSetup.loadSmelteryRecipes() for converting
// Vanilla Gold Ingot to Slimefun gold dust and Vanilla Copper Ingot into Slimefun copper dust
registerRecipe(3, new ItemStack(Material.GOLD_INGOT), SlimefunItems.GOLD_DUST);
registerRecipe(3, new ItemStack(Material.GOLD_INGOT), SlimefunItems.GOLD_DUST.getDelegate());

if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_17)) {
registerRecipe(3, new ItemStack(Material.COPPER_INGOT), SlimefunItems.COPPER_DUST);
registerRecipe(3, new ItemStack(Material.COPPER_INGOT), SlimefunItems.COPPER_DUST.getDelegate());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ElectricPress(ItemGroup itemGroup, SlimefunItemStack item, RecipeType rec

@Override
protected void registerDefaultRecipes() {
addRecipe(4, new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 3), new ItemStack(Material.COBBLESTONE));
addRecipe(4, new SlimefunItemStack(SlimefunItems.STONE_CHUNK, 3).getDelegate(), new ItemStack(Material.COBBLESTONE));
addRecipe(4, new ItemStack(Material.FLINT, 6), new ItemStack(Material.COBBLESTONE));
addRecipe(5, new ItemStack(Material.GLASS), new ItemStack(Material.GLASS_PANE, 3));
addRecipe(4, new ItemStack(Material.SNOWBALL, 4), new ItemStack(Material.SNOW_BLOCK));
Expand All @@ -44,15 +44,15 @@ protected void registerDefaultRecipes() {
addRecipe(3, new ItemStack(Material.CLAY_BALL, 4), new ItemStack(Material.CLAY));
addRecipe(3, new ItemStack(Material.BRICK, 4), new ItemStack(Material.BRICKS));

addRecipe(6, SlimefunItems.COPPER_INGOT, new CustomItemStack(SlimefunItems.COPPER_WIRE, 3));
addRecipe(6, SlimefunItems.COPPER_INGOT.getDelegate(), new CustomItemStack(SlimefunItems.COPPER_WIRE.getDelegate(), 3));
addRecipe(16, new SlimefunItemStack(SlimefunItems.STEEL_INGOT, 8), SlimefunItems.STEEL_PLATE);
addRecipe(18, new SlimefunItemStack(SlimefunItems.REINFORCED_ALLOY_INGOT, 8), SlimefunItems.REINFORCED_PLATE);

addRecipe(8, new ItemStack(Material.NETHER_WART), new CustomItemStack(SlimefunItems.MAGIC_LUMP_1, 2));
addRecipe(8, new ItemStack(Material.NETHER_WART), new CustomItemStack(SlimefunItems.MAGIC_LUMP_1.getDelegate(), 2));
addRecipe(10, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_1, 4), SlimefunItems.MAGIC_LUMP_2);
addRecipe(12, new SlimefunItemStack(SlimefunItems.MAGIC_LUMP_2, 4), SlimefunItems.MAGIC_LUMP_3);

addRecipe(10, new ItemStack(Material.ENDER_EYE), new CustomItemStack(SlimefunItems.ENDER_LUMP_1, 2));
addRecipe(10, new ItemStack(Material.ENDER_EYE), new CustomItemStack(SlimefunItems.ENDER_LUMP_1.getDelegate(), 2));
addRecipe(12, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_1, 4), SlimefunItems.ENDER_LUMP_2);
addRecipe(14, new SlimefunItemStack(SlimefunItems.ENDER_LUMP_2, 4), SlimefunItems.ENDER_LUMP_3);

Expand Down Expand Up @@ -92,6 +92,11 @@ private void addRecipe(int seconds, ItemStack input, ItemStack output) {
registerRecipe(seconds, new ItemStack[] { input }, new ItemStack[] { output });
}

@ParametersAreNonnullByDefault
private void addRecipe(int seconds, SlimefunItemStack sfi1, SlimefunItemStack sfi2) {
Intybyte marked this conversation as resolved.
Show resolved Hide resolved
registerRecipe(seconds, sfi1.getDelegate(), sfi2.getDelegate());
}

@Override
public ItemStack getProgressBar() {
return new ItemStack(Material.IRON_HOE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private void produceFlasks(@Nonnull Location location, int experiencePoints) {
for (int level = 0; level < getStoredExperience(location); level = level + 10) {
if (menu.fits(SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE, getOutputSlots())) {
withdrawn = withdrawn + 10;
menu.pushItem(SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE.clone(), getOutputSlots());
menu.pushItem(SlimefunItems.FILLED_FLASK_OF_KNOWLEDGE.getDelegate(), getOutputSlots());
} else {
// There is no room for more bottles, so lets stop checking if more will fit.
break;
Expand Down
Loading
Loading