use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.
the class TileEntityBase01Root method drain.
public FluidStack drain(MultiTileEntityMultiBlockPart aPart, byte aDirection, int aAmountToDrain, boolean aDoDrain) {
if (aAmountToDrain <= 0)
return null;
IFluidTank tTank = getFluidTankDrainable(aPart, UT.Code.side(aDirection), null);
if (tTank == null || tTank.getFluid() == null || tTank.getFluidAmount() == 0)
return null;
FluidStack rDrained = tTank.drain(aAmountToDrain, aDoDrain);
if (rDrained != null && aDoDrain)
updateInventory();
return rDrained;
}
use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.
the class TileEntityBase01Root method fill.
public int fill(MultiTileEntityMultiBlockPart aPart, byte aDirection, FluidStack aFluid, boolean aDoFill) {
if (aFluid == null || aFluid.amount <= 0)
return 0;
IFluidTank tTank = getFluidTankFillable(aPart, UT.Code.side(aDirection), aFluid);
if (tTank == null)
return 0;
int rFilledAmount = tTank.fill(aFluid, aDoFill);
if (rFilledAmount > 0 && aDoFill)
updateInventory();
return rFilledAmount;
}
use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.
the class TileEntityBase01Root method fill.
public int fill(ForgeDirection aDirection, FluidStack aFluid, boolean aDoFill) {
if (aFluid == null || aFluid.amount <= 0)
return 0;
IFluidTank tTank = getFluidTankFillable(UT.Code.side(aDirection), aFluid);
if (tTank == null)
return 0;
int rFilledAmount = tTank.fill(aFluid, aDoFill);
if (rFilledAmount > 0 && aDoFill)
updateInventory();
return rFilledAmount;
}
use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.
the class Recipe method isRecipeInputEqual.
public int isRecipeInputEqual(int aMaxProcessCount, IFluidTank[] aFluidInputs, ItemStack... aInputs) {
if (aMaxProcessCount <= 0)
return 0;
if (mFluidInputs.length > 0 && (aFluidInputs == null || aFluidInputs.length < 1))
return 0;
if (mInputs.length > 0 && (aInputs == null || aInputs.length < 1))
return 0;
int rProcessCount = 0;
while (rProcessCount < aMaxProcessCount) {
for (FluidStack tFluid : mFluidInputs) if (tFluid != null) {
boolean temp = T;
for (IFluidTank tTank : aFluidInputs) {
FluidStack aFluid = tTank.getFluid();
if (aFluid != null && aFluid.isFluidEqual(tFluid) && aFluid.amount >= tFluid.amount) {
temp = F;
break;
}
}
if (temp)
return rProcessCount;
}
if (!checkStacksEqual(F, F, aInputs))
return rProcessCount;
for (FluidStack tFluid : mFluidInputs) if (tFluid != null)
for (IFluidTank tTank : aFluidInputs) {
FluidStack aFluid = tTank.getFluid();
if (aFluid != null && aFluid.isFluidEqual(tFluid) && (aFluid.amount >= tFluid.amount)) {
tTank.drain(tFluid.amount, T);
break;
}
}
checkStacksEqual(T, F, aInputs);
rProcessCount++;
}
return rProcessCount;
}
use of net.minecraftforge.fluids.IFluidTank in project gregtech6 by GregTech6.
the class MultiTileEntityMixingBowl method onTick2.
@Override
public void onTick2(long aTimer, boolean aIsServerSide) {
if (aIsServerSide) {
if (SERVER_TIME % 600 == 10 && worldObj.isRaining() && getRainOffset(0, 1, 0)) {
BiomeGenBase tBiome = getBiome();
if (tBiome.rainfall > 0 && tBiome.temperature >= 0.2) {
Block tInFront = getBlockAtSide(SIDE_TOP);
if (!(tInFront instanceof BlockLiquid) && !(tInFront instanceof IFluidBlock) && !tInFront.isSideSolid(worldObj, xCoord, yCoord + 1, zCoord, FORGE_DIR_OPPOSITES[SIDE_TOP]) && !tInFront.isSideSolid(worldObj, xCoord, yCoord + 1, zCoord, FORGE_DIR[SIDE_TOP])) {
FluidStack tWater = FL.Water.make((long) Math.max(1, tBiome.rainfall * 200) * (worldObj.isThundering() ? 2 : 1));
if (tWater != null) {
IFluidTank tTank = getFluidTankFillable2(SIDE_TOP, tWater);
if (tTank != null)
tTank.fill(tWater, T);
}
}
}
}
boolean tBreak = F;
mDisplay = 0;
for (FluidTankGT tTank : mTanksOutput) if (tTank.has()) {
mDisplay = (short) (-2 - tTank.getFluid().getFluidID());
tBreak = T;
break;
}
if (!tBreak) {
for (FluidTankGT tTank : mTanksInput) if (tTank.has()) {
mDisplay = (short) (-2 - tTank.getFluid().getFluidID());
tBreak = T;
break;
}
if (!tBreak) {
ItemStack tStack;
for (int i = 0; i < 7; i++) if (ST.valid(tStack = slot(6 - i))) {
OreDictItemData tData = OM.data_(tStack);
if (tData == null || tData.mMaterial == null) {
mDisplay = -1;
} else {
mDisplay = tData.mMaterial.mMaterial.mID;
}
tBreak = T;
break;
}
}
}
}
}
Aggregations