mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-12-01 14:44:09 +01:00
Added support for overflowed items on suction.
This commit is contained in:
parent
c9e2ca80aa
commit
4578ce1f0c
@ -22,6 +22,8 @@ public class ModuleSuction implements Module {
|
|||||||
|
|
||||||
private final int amount;
|
private final int amount;
|
||||||
|
|
||||||
|
private boolean wildStacker = Bukkit.getPluginManager().isPluginEnabled("WildStacker");
|
||||||
|
|
||||||
public ModuleSuction(int amount) {
|
public ModuleSuction(int amount) {
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
}
|
}
|
||||||
@ -55,7 +57,7 @@ public class ModuleSuction implements Module {
|
|||||||
if (entity.hasMetadata("grabbed") || !entity.isOnGround())
|
if (entity.hasMetadata("grabbed") || !entity.isOnGround())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled("WildStacker"))
|
if (wildStacker)
|
||||||
hopItem.setAmount(WildStackerAPI.getItemAmount((Item)entity));
|
hopItem.setAmount(WildStackerAPI.getItemAmount((Item)entity));
|
||||||
|
|
||||||
ItemStack item = ((Item) entity).getItemStack();
|
ItemStack item = ((Item) entity).getItemStack();
|
||||||
@ -68,8 +70,11 @@ public class ModuleSuction implements Module {
|
|||||||
float yy = (float) (0 + (Math.random() * .3));
|
float yy = (float) (0 + (Math.random() * .3));
|
||||||
float zz = (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);
|
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();
|
entity.remove();
|
||||||
hopperBlock.getInventory().addItem(hopItem);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user