mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 19:59:42 +00:00
Fix accidentally removed not-deprecated methods.
Update FML:d604e44d604e44InterModComms now supports a runtime polling based model for inter-mod comms at runtime. Deprecate method that shouldn't be used. COPY it's content to your mod. Don't CALL it.8b7778cDon't be as alarming about item overwrites.
This commit is contained in:
1 parent
18f77fb10f
commit
0b9727305e
2 files changed
+112
-91
No files matched your search
@@ -6,116 +6,137 @@ import net.minecraft.tileentity.TileEntity;
|
||||
* Reference implementation of ILiquidTank. Use this or implement your own.
|
||||
*/
|
||||
public class LiquidTank implements ILiquidTank {
|
||||
private LiquidStack liquid;
|
||||
private int capacity;
|
||||
private int tankPressure;
|
||||
private TileEntity tile;
|
||||
private LiquidStack liquid;
|
||||
private int capacity;
|
||||
private int tankPressure;
|
||||
private TileEntity tile;
|
||||
|
||||
public LiquidTank(int capacity) {
|
||||
this(null, capacity);
|
||||
}
|
||||
public LiquidTank(int capacity)
|
||||
{
|
||||
this(null, capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(int liquidId, int quantity, int capacity) {
|
||||
this(new LiquidStack(liquidId, quantity), capacity);
|
||||
}
|
||||
public LiquidTank(int liquidId, int quantity, int capacity)
|
||||
{
|
||||
this(new LiquidStack(liquidId, quantity), capacity);
|
||||
}
|
||||
|
||||
public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile) {
|
||||
this(liquidId, quantity, capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile)
|
||||
{
|
||||
this(liquidId, quantity, capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
public LiquidTank(LiquidStack liquid, int capacity) {
|
||||
this.liquid = liquid;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
public LiquidTank(LiquidStack liquid, int capacity)
|
||||
{
|
||||
this.liquid = liquid;
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
public LiquidTank(LiquidStack liquid, int capacity, TileEntity tile)
|
||||
{
|
||||
this(liquid, capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
@Override
|
||||
public LiquidStack getLiquid() {
|
||||
return this.liquid;
|
||||
}
|
||||
public LiquidTank(LiquidStack liquid, int capacity, TileEntity tile)
|
||||
{
|
||||
this(liquid, capacity);
|
||||
this.tile = tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCapacity() {
|
||||
return this.capacity;
|
||||
}
|
||||
@Override
|
||||
public LiquidStack getLiquid()
|
||||
{
|
||||
return this.liquid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(LiquidStack resource, boolean doFill) {
|
||||
if(resource == null || resource.itemID <= 0)
|
||||
return 0;
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return this.capacity;
|
||||
}
|
||||
|
||||
if(liquid == null || liquid.itemID <= 0) {
|
||||
if(resource.amount <= capacity) {
|
||||
if(doFill)
|
||||
this.liquid = resource.copy();
|
||||
return resource.amount;
|
||||
} else {
|
||||
if(doFill) {
|
||||
this.liquid = resource.copy();
|
||||
this.liquid.amount = capacity;
|
||||
if (tile!=null)
|
||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidFillingEvent(liquid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
public void setLiquid(LiquidStack liquid)
|
||||
{
|
||||
this.liquid = liquid;
|
||||
}
|
||||
|
||||
if(!liquid.isLiquidEqual(resource))
|
||||
return 0;
|
||||
public void setCapacity(int capacity)
|
||||
{
|
||||
this.capacity = capacity;
|
||||
}
|
||||
|
||||
int space = capacity - liquid.amount;
|
||||
if(resource.amount <= space) {
|
||||
if(doFill)
|
||||
this.liquid.amount += resource.amount;
|
||||
return resource.amount;
|
||||
} else {
|
||||
@Override
|
||||
public int fill(LiquidStack resource, boolean doFill)
|
||||
{
|
||||
if (resource == null || resource.itemID <= 0) return 0;
|
||||
|
||||
if(doFill)
|
||||
this.liquid.amount = capacity;
|
||||
return space;
|
||||
}
|
||||
if (liquid == null || liquid.itemID <= 0)
|
||||
{
|
||||
if (resource.amount <= capacity)
|
||||
{
|
||||
if (doFill) this.liquid = resource.copy();
|
||||
return resource.amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (doFill)
|
||||
{
|
||||
this.liquid = resource.copy();
|
||||
this.liquid.amount = capacity;
|
||||
if (tile != null)
|
||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidFillingEvent(liquid, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public LiquidStack drain(int maxDrain, boolean doDrain) {
|
||||
if(liquid == null || liquid.itemID <= 0)
|
||||
return null;
|
||||
if(liquid.amount <= 0)
|
||||
return null;
|
||||
if (!liquid.isLiquidEqual(resource)) return 0;
|
||||
|
||||
int used = maxDrain;
|
||||
if(liquid.amount < used)
|
||||
used = liquid.amount;
|
||||
int space = capacity - liquid.amount;
|
||||
if (resource.amount <= space)
|
||||
{
|
||||
if (doFill) this.liquid.amount += resource.amount;
|
||||
return resource.amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(doDrain) {
|
||||
liquid.amount -= used;
|
||||
}
|
||||
if (doFill) this.liquid.amount = capacity;
|
||||
return space;
|
||||
}
|
||||
|
||||
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
|
||||
}
|
||||
|
||||
// Reset liquid if emptied
|
||||
if(liquid.amount <= 0)
|
||||
liquid = null;
|
||||
@Override
|
||||
public LiquidStack drain(int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (liquid == null || liquid.itemID <= 0) return null;
|
||||
if (liquid.amount <= 0) return null;
|
||||
|
||||
if (doDrain && tile!=null)
|
||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
int used = maxDrain;
|
||||
if (liquid.amount < used) used = liquid.amount;
|
||||
|
||||
return drained;
|
||||
}
|
||||
if (doDrain)
|
||||
{
|
||||
liquid.amount -= used;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTankPressure() {
|
||||
return tankPressure;
|
||||
}
|
||||
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
|
||||
|
||||
public void setTankPressure(int pressure)
|
||||
{
|
||||
this.tankPressure = pressure;
|
||||
}
|
||||
// Reset liquid if emptied
|
||||
if (liquid.amount <= 0) liquid = null;
|
||||
|
||||
if (doDrain && tile != null)
|
||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||
|
||||
return drained;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTankPressure()
|
||||
{
|
||||
return tankPressure;
|
||||
}
|
||||
|
||||
public void setTankPressure(int pressure)
|
||||
{
|
||||
this.tankPressure = pressure;
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
Reference in new issue
Block a user