1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 11:45:51 +00:00

Added SlimefunUtils.spawnItem instead of dropItemNaturally

This commit is contained in:
EpicPlayerA10 2021-07-08 12:33:53 +02:00
parent dd343e8e73
commit c148c8b4da
2 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.slimefun4.api.events.SlimefunItemSpawnEvent; import io.github.thebusybiscuit.slimefun4.api.events.SlimefunItemSpawnEvent;
import io.github.thebusybiscuit.slimefun4.core.networks.cargo.CargoNet; 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.altar.AncientPedestal;
import io.github.thebusybiscuit.slimefun4.implementation.items.seasonal.ChristmasPresent; import io.github.thebusybiscuit.slimefun4.implementation.items.seasonal.ChristmasPresent;
import io.github.thebusybiscuit.slimefun4.implementation.items.seasonal.EasterEgg; import io.github.thebusybiscuit.slimefun4.implementation.items.seasonal.EasterEgg;
@ -39,12 +40,18 @@ public enum ItemSpawnReason {
CARGO_OVERFLOW, 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, 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, EASTER_EGG_OPENED,

View File

@ -9,6 +9,8 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault; 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.apache.commons.lang.Validate;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
@ -186,7 +188,7 @@ public abstract class MultiBlockMachine extends SlimefunItem implements NotPlace
containerInv.addItem(outputItem); containerInv.addItem(outputItem);
} else { } else {
// fallback // fallback
container.getWorld().dropItemNaturally(container.getLocation(), outputItem); SlimefunUtils.spawnItem(container.getLocation(), outputItem, ItemSpawnReason.MULTIBLOCK_MACHINE_OVERFLOW, true);
} }
} }