Skip to content

Commit

Permalink
Added SlimefunUtils.spawnItem instead of dropItemNaturally
Browse files Browse the repository at this point in the history
  • Loading branch information
EpicPlayerA10 committed Jul 8, 2021
1 parent dd343e8 commit c148c8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

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;
Expand Down Expand Up @@ -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,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
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;
Expand Down Expand Up @@ -186,7 +188,7 @@ protected void handleCraftedItem(ItemStack outputItem, Container container) {
containerInv.addItem(outputItem);
} else {
// fallback
container.getWorld().dropItemNaturally(container.getLocation(), outputItem);
SlimefunUtils.spawnItem(container.getLocation(), outputItem, ItemSpawnReason.MULTIBLOCK_MACHINE_OVERFLOW, true);
}
}

Expand Down

0 comments on commit c148c8b

Please sign in to comment.