Completing new API for liquids.

This commit is contained in:
SirSengir 2012-07-17 17:49:05 +02:00
parent 2f33943438
commit 45a4c299dd
9 changed files with 75 additions and 0 deletions

View file

@ -9,6 +9,7 @@
package net.minecraft.src.buildcraft.api;
@Deprecated
public interface ILiquidContainer {
public int fill(Orientations from, int quantity, int id, boolean doFill);

View file

@ -9,6 +9,7 @@
package net.minecraft.src.buildcraft.api;
@Deprecated
public class LiquidSlot {
private int liquidId;

View file

@ -0,0 +1,46 @@
package net.minecraft.src.buildcraft.api.liquids;
import net.minecraft.src.buildcraft.api.Orientations;
public interface ITankContainer {
/**
* Fills liquid into internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is pumped in from.
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
* @param doFill If false filling will only be simulated.
* @return Amount of resource that was filled into internal tanks.
*/
int fill(Orientations from, LiquidStack resource, boolean doFill);
/**
* Fills liquid into the specified internal tank.
* @param from Orientation the liquid is pumped in from.
* @param resource LiquidStack representing the maximum amount of liquid filled into the ITankContainer
* @param doFill If false filling will only be simulated.
* @return Amount of resource that was filled into internal tanks.
*/
int fill(int tankIndex, LiquidStack resource, boolean doFill);
/**
* Drains liquid out of internal tanks, distribution is left to the ITankContainer.
* @param from Orientation the liquid is drained to.
* @param maxEmpty Maximum amount of liquid to drain.
* @param doDrain If false draining will only be simulated.
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
*/
LiquidStack drain(Orientations from, int maxEmpty, boolean doDrain);
/**
* Drains liquid out of the specified internal tank.
* @param from Orientation the liquid is drained to.
* @param maxEmpty Maximum amount of liquid to drain.
* @param doDrain If false draining will only be simulated.
* @return LiquidStack representing the liquid and amount actually drained from the ITankContainer
*/
LiquidStack drain(int tankIndex, int maxEmpty, boolean doDrain);
/**
* @return Array of {@link LiquidTank}s contained in this ITankContainer
*/
LiquidTank[] getTanks();
}

View file

@ -0,0 +1,22 @@
package net.minecraft.src.buildcraft.api.liquids;
public class LiquidTank {
private LiquidStack liquid;
private int capacity;
public LiquidTank(int liquidId, int quantity, int capacity) {
this(new LiquidStack(liquidId, quantity), capacity);
}
public LiquidTank(LiquidStack liquid, int capacity) {
this.liquid = liquid;
this.capacity = capacity;
}
public LiquidStack getLiquid() {
return this.liquid;
}
public int getCapacity() {
return this.capacity;
}
}

View file

@ -81,6 +81,7 @@ public class BlockArchitect extends BlockContainer implements ITextureProvider {
world.setBlockMetadata(i, j, k, Orientations.XNeg.ordinal());
break;
case ZPos:
default:
world.setBlockMetadata(i, j, k, Orientations.XPos.ordinal());
break;
}

View file

@ -94,6 +94,7 @@ public class BlockBuilder extends BlockContainer implements ITextureProvider {
world.setBlockMetadata(i, j, k, Orientations.XNeg.ordinal());
break;
case ZPos:
default:
world.setBlockMetadata(i, j, k, Orientations.XPos.ordinal());
break;
}

View file

@ -108,6 +108,7 @@ public class BlockQuarry extends BlockMachineRoot implements ITextureProvider {
case XPos:
searchFrames(world, i + 1, j, k);
case XNeg:
default:
searchFrames(world, i - 1, j, k);
}
}

View file

@ -94,6 +94,7 @@ public class BlockRefinery extends BlockContainer {
world.setBlockMetadata(i, j, k, Orientations.XNeg.ordinal());
break;
case ZPos:
default:
world.setBlockMetadata(i, j, k, Orientations.XPos.ordinal());
break;
}

View file

@ -542,6 +542,7 @@ public class TileQuarry extends TileMachine implements IArmListener, IMachine, I
zMin = zCoord + 1;
break;
case ZNeg:
default:
xMin = xCoord - 4 - 1;
zMin = zCoord - 9 - 2;
break;