From c148c8b4da0933284ae017bb6b58bac58648d21c Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 Date: Thu, 8 Jul 2021 12:33:53 +0200 Subject: [PATCH] Added SlimefunUtils.spawnItem instead of dropItemNaturally --- .../slimefun4/api/items/ItemSpawnReason.java | 11 +++++++++-- .../slimefun4/core/multiblocks/MultiBlockMachine.java | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSpawnReason.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSpawnReason.java index 554bc6ad5..49f1e1f85 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSpawnReason.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/items/ItemSpawnReason.java @@ -5,6 +5,7 @@ import org.bukkit.inventory.ItemStack; import io.github.thebusybiscuit.slimefun4.api.events.SlimefunItemSpawnEvent; import io.github.thebusybiscuit.slimefun4.core.networks.cargo.CargoNet; +import io.github.thebusybiscuit.slimefun4.core.multiblocks.MultiBlockMachine; import io.github.thebusybiscuit.slimefun4.implementation.items.altar.AncientPedestal; import io.github.thebusybiscuit.slimefun4.implementation.items.seasonal.ChristmasPresent; import io.github.thebusybiscuit.slimefun4.implementation.items.seasonal.EasterEgg; @@ -39,12 +40,18 @@ public enum ItemSpawnReason { CARGO_OVERFLOW, /** - * THe {@link ItemStack} is dropped as the result of an opened {@link ChristmasPresent}. + * The {@link ItemStack} is dropped as the result of a {@link MultiBlockMachine} + * overflowing. + */ + MULTIBLOCK_MACHINE_OVERFLOW, + + /** + * The {@link ItemStack} is dropped as the result of an opened {@link ChristmasPresent}. */ CHRISTMAS_PRESENT_OPENED, /** - * THe {@link ItemStack} is dropped as the result of an opened {@link EasterEgg}. + * The {@link ItemStack} is dropped as the result of an opened {@link EasterEgg}. */ EASTER_EGG_OPENED, diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java index 0fa73c2d1..b7281fd88 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/core/multiblocks/MultiBlockMachine.java @@ -9,6 +9,8 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import io.github.thebusybiscuit.slimefun4.api.items.ItemSpawnReason; +import io.github.thebusybiscuit.slimefun4.utils.SlimefunUtils; import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.World; @@ -186,7 +188,7 @@ public abstract class MultiBlockMachine extends SlimefunItem implements NotPlace containerInv.addItem(outputItem); } else { // fallback - container.getWorld().dropItemNaturally(container.getLocation(), outputItem); + SlimefunUtils.spawnItem(container.getLocation(), outputItem, ItemSpawnReason.MULTIBLOCK_MACHINE_OVERFLOW, true); } }