use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class TileEntitySheetmetalTank method update.
@Override
public void update() {
if (pos == 4 && !worldObj.isRemote && worldObj.isBlockIndirectlyGettingPowered(getPos()) > 0)
for (int i = 0; i < 6; i++) if (i != 1 && tank.getFluidAmount() > 0) {
EnumFacing f = EnumFacing.getFront(i);
int outSize = Math.min(144, tank.getFluidAmount());
FluidStack out = new FluidStack(tank.getFluid().getFluid(), outSize);
BlockPos outputPos = getPos().offset(f);
IFluidHandler output = FluidUtil.getFluidHandler(worldObj, outputPos, f.getOpposite());
if (output != null) {
int accepted = output.fill(out, false);
if (accepted > 0) {
int drained = output.fill(Utils.copyFluidStackWithAmount(out, Math.min(out.amount, accepted), false), true);
this.tank.drain(drained, true);
this.markContainingBlockForUpdate(null);
updateComparatorValuesPart2();
}
}
}
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class TileEntitySheetmetalTank method getOverlayText.
// @Override
// public TileEntitySheetmetalTank master()
// {
// if(offset[0]==0&&offset[1]==0&&offset[2]==0)
// return null;
// TileEntity te = worldObj.getTileEntity(xCoord-offset[0], yCoord-offset[1], zCoord-offset[2]);
// return te instanceof TileEntitySheetmetalTank?(TileEntitySheetmetalTank)te : null;
// }
@Override
public String[] getOverlayText(EntityPlayer player, RayTraceResult mop, boolean hammer) {
if (Utils.isFluidRelatedItemStack(player.getHeldItem(EnumHand.MAIN_HAND))) {
TileEntitySheetmetalTank master = master();
FluidStack fs = master != null ? master.tank.getFluid() : this.tank.getFluid();
String s = null;
if (fs != null)
s = fs.getLocalizedName() + ": " + fs.amount + "mB";
else
s = I18n.format(Lib.GUI + "empty");
return new String[] { s };
}
return null;
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class ItemJerrycan method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean adv) {
FluidStack fs = FluidUtil.getFluidContained(stack);
if (fs != null) {
TextFormatting rarity = fs.getFluid().getRarity() == EnumRarity.COMMON ? TextFormatting.GRAY : fs.getFluid().getRarity().rarityColor;
list.add(rarity + fs.getLocalizedName() + TextFormatting.GRAY + ": " + fs.amount + "/" + 10000 + "mB");
} else
list.add(I18n.format(Lib.DESC_FLAVOUR + "drill.empty"));
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class MultiblockRecipe method setupJEI.
public void setupJEI() {
if (inputList != null) {
this.jeiItemInputList = new ArrayList[inputList.size()];
this.jeiTotalItemInputList = new ArrayList();
for (int i = 0; i < inputList.size(); i++) {
IngredientStack ingr = inputList.get(i);
ArrayList list = new ArrayList();
if (ingr.oreName != null)
for (ItemStack stack : OreDictionary.getOres(ingr.oreName)) list.add(ApiUtils.copyStackWithAmount(stack, ingr.inputSize));
else if (ingr.stackList != null)
for (ItemStack stack : ingr.stackList) list.add(ApiUtils.copyStackWithAmount(stack, ingr.inputSize));
else
list.add(ApiUtils.copyStackWithAmount(ingr.stack, ingr.inputSize));
this.jeiItemInputList[i] = list;
this.jeiTotalItemInputList.addAll(list);
}
} else
this.jeiTotalItemInputList = Collections.emptyList();
if (outputList != null) {
this.jeiItemOutputList = new ArrayList[outputList.size()];
this.jeiTotalItemOutputList = new ArrayList();
for (int i = 0; i < outputList.size(); i++) {
ItemStack s = outputList.get(i);
ArrayList<ItemStack> list = Lists.newArrayList(s != null ? s.copy() : null);
this.jeiItemOutputList[i] = list;
this.jeiTotalItemOutputList.addAll(list);
}
} else
this.jeiTotalItemOutputList = Collections.emptyList();
if (fluidInputList != null) {
this.jeiFluidInputList = new ArrayList();
for (int i = 0; i < fluidInputList.size(); i++) {
FluidStack fs = fluidInputList.get(i);
if (fs != null)
this.jeiFluidInputList.add(fs.copy());
}
} else
this.jeiFluidInputList = Collections.emptyList();
if (fluidOutputList != null) {
this.jeiFluidOutputList = new ArrayList();
for (int i = 0; i < fluidOutputList.size(); i++) {
FluidStack fs = fluidOutputList.get(i);
if (fs != null)
this.jeiFluidOutputList.add(fs.copy());
}
} else
this.jeiFluidOutputList = Collections.emptyList();
}
use of net.minecraftforge.fluids.FluidStack in project ImmersiveEngineering by BluSunrize.
the class RefineryRecipe method loadFromNBT.
public static RefineryRecipe loadFromNBT(NBTTagCompound nbt) {
FluidStack input0 = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("input0"));
FluidStack input1 = FluidStack.loadFluidStackFromNBT(nbt.getCompoundTag("input1"));
return findRecipe(input0, input1);
}
Aggregations