From 4578ce1f0cf0e65024cc6b558f9235af195ce550 Mon Sep 17 00:00:00 2001 From: Brianna O'Keefe Date: Tue, 1 Jan 2019 23:41:41 -0500 Subject: [PATCH] Added support for overflowed items on suction. --- .../epichoppers/hopper/levels/modules/ModuleSuction.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java index e3eb0aa..f6d2639 100644 --- a/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java +++ b/EpicHoppers-Plugin/src/main/java/com/songoda/epichoppers/hopper/levels/modules/ModuleSuction.java @@ -21,6 +21,8 @@ import java.util.List; public class ModuleSuction implements Module { private final int amount; + + private boolean wildStacker = Bukkit.getPluginManager().isPluginEnabled("WildStacker"); public ModuleSuction(int amount) { this.amount = amount; @@ -55,7 +57,7 @@ public class ModuleSuction implements Module { if (entity.hasMetadata("grabbed") || !entity.isOnGround()) continue; - if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) + if (wildStacker) hopItem.setAmount(WildStackerAPI.getItemAmount((Item)entity)); ItemStack item = ((Item) entity).getItemStack(); @@ -68,8 +70,11 @@ public class ModuleSuction implements Module { float yy = (float) (0 + (Math.random() * .3)); float zz = (float) (0 + (Math.random() * .3)); Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(entity.getLocation(), xx, yy, zz, 0, "FLAME", 5); + + for (ItemStack itemStack : hopperBlock.getInventory().addItem(hopItem).values()) { + entity.getWorld().dropItemNaturally(entity.getLocation(), itemStack); + } entity.remove(); - hopperBlock.getInventory().addItem(hopItem); break; } }