Push for liquid API changes

This commit is contained in:
Christian 2012-11-14 10:29:28 -05:00
parent 98be088256
commit 9dbd922ada
10 changed files with 45 additions and 14 deletions

View file

@ -27,7 +27,7 @@ public class BptBlockEngine extends BptBlock {
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
int o = slot.cpt.getInteger("orientation");
o = ForgeDirection.values()[o].getLeftRotation().ordinal();
o = ForgeDirection.values()[o].getRotation(ForgeDirection.DOWN).ordinal();
slot.cpt.setInteger("orientation", o);
}

View file

@ -14,6 +14,7 @@ import java.util.LinkedList;
import buildcraft.BuildCraftCore;
import buildcraft.BuildCraftEnergy;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.liquids.ILiquidTank;
import net.minecraftforge.liquids.ITankContainer;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.liquids.LiquidTank;
@ -476,4 +477,9 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
}
}
@Override
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -21,7 +21,7 @@ public class BptBlockRefinery extends BptBlock {
@Override
public void rotateLeft(BptSlotInfo slot, IBptContext context) {
slot.meta = ForgeDirection.values()[slot.meta].getLeftRotation().ordinal();
slot.meta = ForgeDirection.values()[slot.meta].getRotation(ForgeDirection.DOWN).ordinal();
}
@Override

View file

@ -1,8 +1,8 @@
/**
/**
* Copyright (c) SpaceToad, 2011
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
@ -225,14 +225,14 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
private boolean containsInput(LiquidStack liquid) {
if(liquid == null)
return true;
return new LiquidStack(slot1.liquidId, slot1.quantity, 0).containsLiquid(liquid) || new LiquidStack(slot2.liquidId, slot2.quantity, 0).containsLiquid(liquid);
}
private boolean consumeInput(LiquidStack liquid) {
if(liquid == null)
return true;
if(new LiquidStack(slot1.liquidId, slot1.quantity, 0).containsLiquid(liquid)) {
slot1.quantity -= liquid.amount;
return true;
@ -240,7 +240,7 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
slot2.quantity -= liquid.amount;
return true;
}
return false;
}
@ -457,4 +457,10 @@ public class TileRefinery extends TileMachine implements ITankContainer, IPowerR
};
}
@Override
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -82,14 +82,14 @@ public class TileTank extends TileBuildCraft implements ITankContainer
public void readFromNBT(NBTTagCompound data)
{
super.readFromNBT(data);
if(data.hasKey("stored") && data.hasKey("liquidId"))
{
LiquidStack liquid = new LiquidStack(data.getInteger("liquidId"), data.getInteger("stored"), 0);
tank.setLiquid(liquid);
}
else
{
{
LiquidStack liquid = new LiquidStack(0, 0, 0);
liquid.readFromNBT(data.getCompoundTag("tank"));
tank.setLiquid(liquid);
@ -253,4 +253,10 @@ public class TileTank extends TileBuildCraft implements ITankContainer
compositeTank.setCapacity(capacity);
return new ILiquidTank[]{compositeTank};
}
@Override
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -464,4 +464,9 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
return internalTanks;
}
@Override
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -548,7 +548,7 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
@Override
public ILiquidTank[] getTanks(ForgeDirection direction) {
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof ITankContainer)
return ((ITankContainer) pipe.transport).getTanks(ForgeDirection.UNKNOWN);
return ((ITankContainer) pipe.transport).getTanks(direction);
else
return null;
}
@ -629,4 +629,12 @@ public class TileGenericPipe extends TileEntity implements IPowerReceptor, ITank
public double func_82115_m() {
return 24 * 24;
}
@Override
public ILiquidTank getTank(ForgeDirection direction, LiquidStack type) {
if (BlockGenericPipe.isValid(pipe) && pipe.transport instanceof ITankContainer)
return ((ITankContainer) pipe.transport).getTank(direction, type);
else
return null;
}
}

View file

@ -39,7 +39,7 @@ public class BptItemPipeDiamond extends BptItem {
newInv[dir * 9 + s] = inv[dir * 9 + s];
for (int dir = 2; dir <= 5; ++dir) {
ForgeDirection r = ForgeDirection.values()[dir].getLeftRotation();
ForgeDirection r = ForgeDirection.values()[dir].getRotation(ForgeDirection.DOWN);
for (int s = 0; s < 9; ++s)
newInv[r.ordinal() * 9 + s] = inv[dir * 9 + s];

View file

@ -39,7 +39,7 @@ public class BptItemPipeIron extends BptItem {
int orientation = slot.meta & 7;
int others = slot.meta - orientation;
slot.meta = ForgeDirection.values()[orientation].getLeftRotation().ordinal() + others;
slot.meta = ForgeDirection.values()[orientation].getRotation(ForgeDirection.DOWN).ordinal() + others;
}
}

View file

@ -39,7 +39,7 @@ public class BptItemPipeWooden extends BptItem {
int orientation = slot.meta & 7;
int others = slot.meta - orientation;
slot.meta = ForgeDirection.values()[orientation].getLeftRotation().ordinal() + others;
slot.meta = ForgeDirection.values()[orientation].getRotation(ForgeDirection.DOWN).ordinal() + others;
}
}