mirror of
https://github.com/songoda/EpicHoppers.git
synced 2024-11-26 04:05:48 +01:00
fixed suction losing items.
This commit is contained in:
parent
3bebfe6030
commit
54fce274b0
@ -82,8 +82,6 @@ public class HopHandler {
|
||||
|
||||
Hopper hopperBlock = hopper.getHopper();
|
||||
|
||||
ItemStack[] is = hopperBlock.getInventory().getContents();
|
||||
|
||||
List<Material> blockedMaterials = new ArrayList<>();
|
||||
|
||||
for (Module module : hopper.getLevel().getRegisteredModules()) {
|
||||
@ -96,6 +94,8 @@ public class HopHandler {
|
||||
blockedMaterials.addAll(materials);
|
||||
}
|
||||
|
||||
ItemStack[] is = hopperBlock.getInventory().getContents();
|
||||
|
||||
if (hopper.getLinkedBlocks() == null || hopper.getLinkedBlocks().isEmpty()) continue;
|
||||
|
||||
for (Block destBlock : hopper.getLinkedBlocks()) {
|
||||
|
@ -39,36 +39,36 @@ public class ModuleSuction implements Module {
|
||||
|
||||
Collection<Entity> nearbyEntite = hopper.getLocation().getWorld().getNearbyEntities(hopper.getLocation().add(0.5, 0.5, 0.5), radius, radius, radius);
|
||||
|
||||
for (Entity e : nearbyEntite) {
|
||||
if (!(e instanceof Item) || e.getTicksLived() < 10 || e.getLocation().getBlock().getType() == Material.HOPPER) {
|
||||
for (Entity entity : nearbyEntite) {
|
||||
if (!(entity instanceof Item) || entity.getTicksLived() < 10 || entity.getLocation().getBlock().getType() == Material.HOPPER) {
|
||||
continue;
|
||||
}
|
||||
ItemStack hopItem = ((Item) e).getItemStack().clone();
|
||||
|
||||
ItemStack hopItem = ((Item) entity).getItemStack().clone();
|
||||
if (hopItem.getType().name().contains("SHULKER_BOX"))
|
||||
continue;
|
||||
|
||||
if (hopItem.hasItemMeta() && hopItem.getItemMeta().hasDisplayName() &&
|
||||
StringUtils.substring(hopItem.getItemMeta().getDisplayName(), 0, 3).equals("***")) {
|
||||
continue; //Compatibility with Shop instance: https://www.spigotmc.org/resources/shop-a-simple-intuitive-shop-instance.9628/
|
||||
}
|
||||
if (e.hasMetadata("grabbed"))
|
||||
if (entity.hasMetadata("grabbed") || !entity.isOnGround())
|
||||
continue;
|
||||
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("WildStacker")) {
|
||||
hopItem.setAmount(WildStackerAPI.getItemAmount((Item)e));
|
||||
}
|
||||
ItemStack item = ((Item) e).getItemStack();
|
||||
if (Bukkit.getPluginManager().isPluginEnabled("WildStacker"))
|
||||
hopItem.setAmount(WildStackerAPI.getItemAmount((Item)entity));
|
||||
|
||||
ItemStack item = ((Item) entity).getItemStack();
|
||||
if (!canMove(hopperBlock.getInventory(), item)) {
|
||||
continue;
|
||||
}
|
||||
if (!e.isOnGround())
|
||||
continue;
|
||||
((Item) e).setPickupDelay(10);
|
||||
e.setMetadata("grabbed", new FixedMetadataValue(EpicHoppersPlugin.getInstance(), ""));
|
||||
((Item) entity).setPickupDelay(10);
|
||||
entity.setMetadata("grabbed", new FixedMetadataValue(EpicHoppersPlugin.getInstance(), ""));
|
||||
float xx = (float) (0 + (Math.random() * .3));
|
||||
float yy = (float) (0 + (Math.random() * .3));
|
||||
float zz = (float) (0 + (Math.random() * .3));
|
||||
Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(e.getLocation(), xx, yy, zz, 0, "FLAME", 5);
|
||||
e.remove();
|
||||
Arconix.pl().getApi().packetLibrary.getParticleManager().broadcastParticle(entity.getLocation(), xx, yy, zz, 0, "FLAME", 5);
|
||||
entity.remove();
|
||||
hopperBlock.getInventory().addItem(hopItem);
|
||||
break;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ interface.hopper.teleport = "&7Teleport: &6%enabled%"
|
||||
interface.hopper.filter = "&7Filter: &6%enabled%"
|
||||
interface.hopper.crafting = "&7AutoCrafting: &6%enabled%"
|
||||
interface.hopper.suction = "&7Suction: &6%suction%"
|
||||
interface.hopper.linkamount = "&7Link Amount: &6%amount%"
|
||||
interface.hopper.linkamount = "&7Link Overflow: &6%amount%"
|
||||
interface.hopper.blockbreak = "&7Block Break: &6Every %ticks% ticks"
|
||||
interface.hopper.alreadymaxed = "&7This hopper is already maxed out!"
|
||||
interface.hopper.synclore = "|&7Left-Click then click a another|&7hopper or chest to link!||&7Right-Click to unlink."
|
||||
|
Loading…
Reference in New Issue
Block a user