001 package net.minecraftforge.liquids; 002 003 /** 004 * A tank is the unit of interaction with liquid inventories. 005 * 006 * @author cpw 007 */ 008 public interface ILiquidTank { 009 010 /** 011 * @return LiquidStack representing the liquid contained in the tank, null if empty. 012 */ 013 LiquidStack getLiquid(); 014 015 /** 016 * These shouldn't be used to interact with a foreign tank. Use {@link #fill(LiquidStack, boolean)} 017 * and {@link #drain(int, boolean)}. 018 * 019 * @param liquid 020 */ 021 @Deprecated 022 void setLiquid(LiquidStack liquid); 023 /** 024 * This method should not be used to interact with a foreign tank. Use {@link #fill(LiquidStack, boolean)} 025 * and {@link #drain(int, boolean)}. 026 * 027 * @param capacity 028 */ 029 @Deprecated 030 void setCapacity(int capacity); 031 032 /** 033 * @return capacity of this tank 034 */ 035 int getCapacity(); 036 037 /** 038 * 039 * @param resource 040 * @param doFill 041 * @return Amount of liquid used for filling. 042 */ 043 int fill(LiquidStack resource, boolean doFill); 044 /** 045 * 046 * @param maxDrain 047 * @param doDrain 048 * @return Null if nothing was drained, otherwise a LiquidStack containing the drained. 049 */ 050 LiquidStack drain(int maxDrain, boolean doDrain); 051 052 /** 053 * Positive values indicate a positive liquid pressure (liquid wants to leave this tank) 054 * Negative values indicate a negative liquid pressure (liquid wants to fill this tank) 055 * Zero indicates no pressure 056 * 057 * @return a number indicating tank pressure 058 */ 059 public int getTankPressure(); 060 061 }