@Override public boolean isTriggerActive(Pipe pipe, ITriggerParameter parameter) { if (pipe.transport instanceof PipeTransportItems) { PipeTransportItems transportItems = (PipeTransportItems) pipe.transport; if (kind == Kind.Empty) return transportItems.travelingEntities.isEmpty(); else if (kind == Kind.ContainsItems) if (parameter != null && parameter.getItem() != null) { for (EntityData data : transportItems.travelingEntities.values()) if (data.item.getItemStack().itemID == parameter.getItem().itemID && data.item.getItemStack().getItemDamage() == parameter.getItem().getItemDamage()) return true; } else return !transportItems.travelingEntities.isEmpty(); } else if (pipe.transport instanceof PipeTransportLiquids) { PipeTransportLiquids transportLiquids = (PipeTransportLiquids) pipe.transport; LiquidStack searchedLiquid = null; if (parameter != null && parameter.getItem() != null) searchedLiquid = LiquidManager.getLiquidForFilledItem(parameter.getItem()); if (kind == Kind.Empty) { for (ILiquidTank b : transportLiquids.getTanks()) if (b.getLiquid() != null && b.getLiquid().amount != 0) return false; return true; } else { for (ILiquidTank b : transportLiquids.getTanks()) if (b.getLiquid() != null && b.getLiquid().amount != 0) if (searchedLiquid == null || searchedLiquid.isLiquidEqual(b.getLiquid())) return true; return false; } } else if (pipe.transport instanceof PipeTransportPower) { PipeTransportPower transportPower = (PipeTransportPower) pipe.transport; if (kind == Kind.Empty) { for (short s : transportPower.displayPower) if (s != 0) return false; return true; } else { for (short s : transportPower.displayPower) if (s != 0) return true; return false; } } return false; }
@Override public ItemStack getItemStack() { ITriggerParameter parameter = pipe.getTriggerParameter(slot); if (parameter != null) return parameter.getItem(); else return null; }