@Override public IFluidTankProperties[] getTankProperties() { if(hasParent()) { IFluidHandler iFluidHandler = parent.get(); assert iFluidHandler != null; IFluidTankProperties[] iFluidTankPropertiesArray = iFluidHandler.getTankProperties(); if(iFluidTankPropertiesArray.length > 0) { IFluidTankProperties fluidTankProperties = iFluidHandler.getTankProperties()[0]; return new IFluidTankProperties[]{new FluidTankProperties(fluidTankProperties.getContents(), fluidTankProperties.getCapacity(), true, false)}; } } return EmptyFluidHandler.EMPTY_TANK_PROPERTIES_ARRAY; }
public static boolean isDrainableFilledContainer(ItemStack container) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(container); if (fluidHandler == null) { return false; } IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); for (IFluidTankProperties properties : tankProperties) { if (!properties.canDrain()) { return false; } FluidStack contents = properties.getContents(); if (contents == null || contents.amount < properties.getCapacity()) { return false; } } return true; }
public static boolean isFillableContainerWithRoom(ItemStack container) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(container); if (fluidHandler == null) { return false; } IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); for (IFluidTankProperties properties : tankProperties) { if (properties.canFill() && properties.getCapacity() > 0) { FluidStack contents = properties.getContents(); if (contents == null) { return true; } else if (contents.amount < properties.getCapacity()) { return true; } } } return false; }
high = Math.max( high, slot ); final FluidStack newIS = !props[slot].canDrain() && this.getMode() == StorageFilter.EXTRACTABLE_ONLY ? null : props[slot].getContents(); final FluidStack oldIS = old == null ? null : old.fluidStack;
final FluidStack newFS = tankProperties[slot].getContents();
FluidStack contents = properties.getContents(); player.sendMessage(new TextComponentTranslation("gregtech.command.util.hand.fluid", contents == null ? "empty" : contents.getFluid().getName(), contents == null ? 0 : contents.amount, properties.getCapacity(), Boolean.toString(properties.canFill()), Boolean.toString(properties.canDrain())));
@Override public int getCapacity() { return internalTankProperties.getCapacity(); }
public static boolean isFillableEmptyContainer(ItemStack empty) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(empty); if (fluidHandler == null) { return false; } IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); for (IFluidTankProperties properties : tankProperties) { if (!properties.canFill()) { return false; } FluidStack contents = properties.getContents(); if (contents != null && contents.amount > 0) { return false; } } return true; }
@Override public boolean canDrain() { return internalTankProperties.canDrain(); }
private static boolean canFill(IFluidHandler fluidHandler) { for (IFluidTankProperties properties : fluidHandler.getTankProperties()) { if (properties.canFill()) { return true; } } return false; } }
@Override public boolean canDrainFluidType(FluidStack fluidStack) { return internalTankProperties.canDrainFluidType(fluidStack); } }
@Nullable @Override public FluidStack getContents() { return internalTankProperties.getContents(); }
if (tankProperties != null) { for (IFluidTankProperties properties : tankProperties) { if (properties.canDrain() && properties.getCapacity() > 0) { FluidStack contents = properties.getContents(); if (contents != null) { if (tank.getFluid() == null || tank.getFluid().amount < tank.getCapacity() && tank.getFluid().containsFluid(new FluidStack(contents.getFluid(), 0))) { if (tankProperties != null) { for (IFluidTankProperties properties : tankProperties) { if (properties != null && properties.canFill() && properties.getCapacity() > 0) { FluidStack contents = properties.getContents(); if (tank.getFluid() != null) { if (contents == null || contents.amount <= properties.getCapacity() - tank.getFluid().amount && contents.containsFluid(new FluidStack(tank.getFluid(), 0))) { recepticle.fill(tank.drain(new FluidStack(tank.getFluid(), tank.getFluid().amount), true), true); markDirty();
@Nonnull @Override public Map<Object, Object> getMeta(@Nonnull IFluidTankProperties tank) { return Collections.singletonMap("capacity", tank.getCapacity()); }
public static boolean isDrainableFilledContainer(ItemStack container) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(container); if (fluidHandler == null) { return false; } IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); for (IFluidTankProperties properties : tankProperties) { if (!properties.canDrain()) { return false; } FluidStack contents = properties.getContents(); if (contents == null || contents.amount <= 0) { return false; } } return fluidHandler.drain(Integer.MAX_VALUE, false) != null; } }
public static boolean isFillableEmptyContainer(ItemStack empty) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(empty); if (fluidHandler == null) { return false; } IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); for (IFluidTankProperties properties : tankProperties) { if (!properties.canFill()) { return false; } FluidStack contents = properties.getContents(); if (contents != null && contents.amount > 0) { return false; } } return true; }
private static boolean canDrain(IFluidHandler fluidHandler) { for (IFluidTankProperties properties : fluidHandler.getTankProperties()) { if (properties.canDrain()) { return true; } } return false; }
public static boolean isFillableContainer(ItemStack container) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(container); if (fluidHandler == null) { return false; } IFluidTankProperties[] tankProperties = fluidHandler.getTankProperties(); for (IFluidTankProperties properties : tankProperties) { if (properties.canFill()) { return true; } } return false; }
@Override public boolean canDrain(FluidIdentifier fluid) { IFluidTankProperties[] tanks = fluidhandler.getTankProperties(); if(tanks != null) { for(IFluidTankProperties tank : tanks) { if(tank.canDrainFluidType(fluid.makeFluidStack(1))) { return true; } } } return false; }
@Override public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { if(config.getConfig(WailaRegistrar.CONFIG_TANK)) { TileEntity te = accessor.getTileEntity(); if(te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) { IFluidHandler fluidHandler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null); assert fluidHandler != null; IFluidTankProperties[] fluidHandlerTankProperties = fluidHandler.getTankProperties(); for(IFluidTankProperties fluidTankProperties : fluidHandlerTankProperties) { FluidStack fluidStack = fluidTankProperties.getContents(); if(fluidStack != null) { currenttip.add(Util.translateFormatted("gui.waila.tank.fluid", fluidStack.getLocalizedName())); currenttip.add(Util.translateFormatted("gui.waila.tank.amount", fluidStack.amount, fluidTankProperties.getCapacity())); } else { currenttip.add(Util.translate("gui.waila.tank.empty")); } } } } return currenttip; }