Fix accidentally removed not-deprecated methods.
Update FML: d604e44 d604e44 InterModComms 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. 8b7778c Don't be as alarming about item overwrites.
This commit is contained in:
parent
18f77fb10f
commit
0b9727305e
2 changed files with 112 additions and 91 deletions
|
@ -11,20 +11,24 @@ public class LiquidTank implements ILiquidTank {
|
||||||
private int tankPressure;
|
private int tankPressure;
|
||||||
private TileEntity tile;
|
private TileEntity tile;
|
||||||
|
|
||||||
public LiquidTank(int capacity) {
|
public LiquidTank(int capacity)
|
||||||
|
{
|
||||||
this(null, capacity);
|
this(null, capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiquidTank(int liquidId, int quantity, int capacity) {
|
public LiquidTank(int liquidId, int quantity, int capacity)
|
||||||
|
{
|
||||||
this(new LiquidStack(liquidId, quantity), capacity);
|
this(new LiquidStack(liquidId, quantity), capacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile) {
|
public LiquidTank(int liquidId, int quantity, int capacity, TileEntity tile)
|
||||||
|
{
|
||||||
this(liquidId, quantity, capacity);
|
this(liquidId, quantity, capacity);
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LiquidTank(LiquidStack liquid, int capacity) {
|
public LiquidTank(LiquidStack liquid, int capacity)
|
||||||
|
{
|
||||||
this.liquid = liquid;
|
this.liquid = liquid;
|
||||||
this.capacity = capacity;
|
this.capacity = capacity;
|
||||||
}
|
}
|
||||||
|
@ -34,28 +38,45 @@ public class LiquidTank implements ILiquidTank {
|
||||||
this(liquid, capacity);
|
this(liquid, capacity);
|
||||||
this.tile = tile;
|
this.tile = tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiquidStack getLiquid() {
|
public LiquidStack getLiquid()
|
||||||
|
{
|
||||||
return this.liquid;
|
return this.liquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCapacity() {
|
public int getCapacity()
|
||||||
|
{
|
||||||
return this.capacity;
|
return this.capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setLiquid(LiquidStack liquid)
|
||||||
public int fill(LiquidStack resource, boolean doFill) {
|
{
|
||||||
if(resource == null || resource.itemID <= 0)
|
this.liquid = liquid;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
if(liquid == null || liquid.itemID <= 0) {
|
public void setCapacity(int capacity)
|
||||||
if(resource.amount <= capacity) {
|
{
|
||||||
if(doFill)
|
this.capacity = capacity;
|
||||||
this.liquid = resource.copy();
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int fill(LiquidStack resource, boolean doFill)
|
||||||
|
{
|
||||||
|
if (resource == null || resource.itemID <= 0) return 0;
|
||||||
|
|
||||||
|
if (liquid == null || liquid.itemID <= 0)
|
||||||
|
{
|
||||||
|
if (resource.amount <= capacity)
|
||||||
|
{
|
||||||
|
if (doFill) this.liquid = resource.copy();
|
||||||
return resource.amount;
|
return resource.amount;
|
||||||
} else {
|
}
|
||||||
if(doFill) {
|
else
|
||||||
|
{
|
||||||
|
if (doFill)
|
||||||
|
{
|
||||||
this.liquid = resource.copy();
|
this.liquid = resource.copy();
|
||||||
this.liquid.amount = capacity;
|
this.liquid.amount = capacity;
|
||||||
if (tile != null)
|
if (tile != null)
|
||||||
|
@ -65,42 +86,41 @@ public class LiquidTank implements ILiquidTank {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!liquid.isLiquidEqual(resource))
|
if (!liquid.isLiquidEqual(resource)) return 0;
|
||||||
return 0;
|
|
||||||
|
|
||||||
int space = capacity - liquid.amount;
|
int space = capacity - liquid.amount;
|
||||||
if(resource.amount <= space) {
|
if (resource.amount <= space)
|
||||||
if(doFill)
|
{
|
||||||
this.liquid.amount += resource.amount;
|
if (doFill) this.liquid.amount += resource.amount;
|
||||||
return resource.amount;
|
return resource.amount;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if(doFill)
|
if (doFill) this.liquid.amount = capacity;
|
||||||
this.liquid.amount = capacity;
|
|
||||||
return space;
|
return space;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LiquidStack drain(int maxDrain, boolean doDrain) {
|
public LiquidStack drain(int maxDrain, boolean doDrain)
|
||||||
if(liquid == null || liquid.itemID <= 0)
|
{
|
||||||
return null;
|
if (liquid == null || liquid.itemID <= 0) return null;
|
||||||
if(liquid.amount <= 0)
|
if (liquid.amount <= 0) return null;
|
||||||
return null;
|
|
||||||
|
|
||||||
int used = maxDrain;
|
int used = maxDrain;
|
||||||
if(liquid.amount < used)
|
if (liquid.amount < used) used = liquid.amount;
|
||||||
used = liquid.amount;
|
|
||||||
|
|
||||||
if(doDrain) {
|
if (doDrain)
|
||||||
|
{
|
||||||
liquid.amount -= used;
|
liquid.amount -= used;
|
||||||
}
|
}
|
||||||
|
|
||||||
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
|
LiquidStack drained = new LiquidStack(liquid.itemID, used, liquid.itemMeta);
|
||||||
|
|
||||||
// Reset liquid if emptied
|
// Reset liquid if emptied
|
||||||
if(liquid.amount <= 0)
|
if (liquid.amount <= 0) liquid = null;
|
||||||
liquid = null;
|
|
||||||
|
|
||||||
if (doDrain && tile != null)
|
if (doDrain && tile != null)
|
||||||
LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
LiquidEvent.fireEvent(new LiquidEvent.LiquidDrainingEvent(drained, tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, this));
|
||||||
|
@ -109,7 +129,8 @@ public class LiquidTank implements ILiquidTank {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTankPressure() {
|
public int getTankPressure()
|
||||||
|
{
|
||||||
return tankPressure;
|
return tankPressure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue