use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class ReservoirTankWrapper method getInputTank.
@Override
public FluidTank getInputTank(FluidStack forFluidType) {
FluidTank parentTank = parents.get(0).getInputTank(forFluidType);
if (parentTank == null) {
return null;
}
int free = parentTank.getCapacity() - parentTank.getFluidAmount();
for (NNIterator<EnumFacing> itr = NNList.FACING.fastIterator(); itr.hasNext(); ) {
TileEntity neighbor = world.getTileEntity(pos.offset(itr.next()));
if (neighbor instanceof ITankAccess) {
FluidTank tank2 = ((ITankAccess) neighbor).getInputTank(forFluidType);
if (tank2 != null) {
free += tank2.getCapacity() - tank2.getFluidAmount();
parents.add(((ITankAccess) neighbor));
}
}
}
if (free < Fluid.BUCKET_VOLUME) {
free = Fluid.BUCKET_VOLUME;
}
return tank = new SmartTank(parentTank.getFluid(), free);
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class KillerJoeRenderMapper method renderFuel.
private List<BakedQuad> renderFuel(ItemStack stack) {
if (stack.hasTagCompound()) {
SmartTank tank = ItemTankHelper.getTank(stack);
HalfBakedList buffer = TankRenderHelper.mkTank(tank, 2.51, 1, 14, false);
if (buffer != null) {
List<BakedQuad> quads = new ArrayList<BakedQuad>();
buffer.bake(quads);
return quads;
}
}
return null;
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class GuiCombustionGenerator method drawGuiContainerBackgroundLayer.
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
bindGuiTexture();
int sx = (width - xSize) / 2;
int sy = (height - ySize) / 2;
drawTexturedModalRect(sx, sy, 0, 0, xSize, ySize);
TileCombustionGenerator gen = getTileEntity();
CombustionMath math = gen.getMath();
FontRenderer fr = getFontRenderer();
int output = 0;
if (gen.isActive()) {
output = math.getEnergyPerTick();
}
String txt = Lang.GUI_COMBGEN_OUTPUT.get(LangPower.RFt(output));
int sw = fr.getStringWidth(txt);
fr.drawStringWithShadow(txt, guiLeft + xSize / 2 - sw / 2, guiTop + fr.FONT_HEIGHT / 2 + 3, ColorUtil.getRGB(Color.WHITE));
int x = guiLeft + 48;
int y = guiTop + 21;
final SmartTank coolantTank = gen.getCoolantTank();
if (!coolantTank.isEmpty()) {
x = guiLeft + 114;
// right tank
final int fluidAmount = coolantTank.getFluidAmount();
final FluidStack fluid = coolantTank.getFluid();
if (fluidAmount > CENTER) {
RenderUtil.renderGuiTank(fluid, coolantTank.getCapacity() - CENTER, fluidAmount - CENTER, x, y, zLevel, 15, 47);
}
if (gen.isActive()) {
txt = LangFluid.tMB(math.getTicksPerCoolant());
sw = fr.getStringWidth(txt);
fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 47, ColorUtil.getRGB(Color.WHITE));
}
// center coolant chamber
RenderUtil.renderGuiTank(fluid, CENTER, Math.min(fluidAmount, CENTER), guiLeft + 72, guiTop + 28, zLevel, 33, 33);
// draw some gui over the top again to make the center shape
bindGuiTexture();
drawTexturedModalRect(guiLeft + 72, guiTop + 28, 0, 223, 33, 33);
}
final SmartTank fuelTank = gen.getFuelTank();
if (!fuelTank.isEmpty()) {
// left tank
x = guiLeft + 48;
final int fluidAmount = fuelTank.getFluidAmount();
final FluidStack fluid = fuelTank.getFluid();
if (fluidAmount > CENTER) {
RenderUtil.renderGuiTank(fluid, fuelTank.getCapacity() - CENTER, fluidAmount - CENTER, x, y, zLevel, 15, 47);
}
if (gen.isActive()) {
txt = LangFluid.tMB(math.getTicksPerFuel());
sw = fr.getStringWidth(txt);
fr.drawStringWithShadow(txt, x - sw / 2 + 7, y + fr.FONT_HEIGHT / 2 + 47, ColorUtil.getRGB(Color.WHITE));
}
// center tank
RenderUtil.renderGuiTank(fluid, CENTER, Math.min(fluidAmount, CENTER), guiLeft + 81, guiTop + 38, zLevel, 14, 14);
}
bindGuiTexture();
super.drawGuiContainerBackgroundLayer(par1, par2, par3);
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class TOPCompatibility method mkTankLines.
private void mkTankLines(ProbeMode mode, EioBox eiobox, TOPData data) {
if (data.tankData != null && !data.tankData.isEmpty()) {
if (mode != ProbeMode.NORMAL || TopConfig.showTanksByDefault.get()) {
for (ITankData tank : data.tankData) {
SmartTank smartTank = new SmartTank(1000);
String content1;
String content2;
final FluidStack fluid = tank.getContent();
if (fluid != null) {
FluidStack fluid2 = fluid.copy();
fluid2.amount = fluid.amount * 1000 / tank.getCapacity();
smartTank.setFluid(fluid2);
content1 = NullHelper.first(fluid.getLocalizedName(), "(???)");
// TODO lang-format those numbers
content2 = loc("top.tank.content", "" + fluid.amount, "" + tank.getCapacity());
} else {
content1 = loc("top.tank.content.empty");
// TODO lang-format those numbers
content2 = loc("top.tank.content", "0", "" + tank.getCapacity());
}
switch(tank.getTankType()) {
case INPUT:
content1 = loc("top.tank.header.input", content1);
break;
case OUTPUT:
content1 = loc("top.tank.header.output", content1);
break;
case STORAGE:
content1 = loc("top.tank.header.storage", content1);
break;
}
// sic!
ItemStack stack = new ItemStack(ModObject.blockFusedQuartz.getBlockNN());
ItemTankHelper.setTank(stack, smartTank);
NbtValue.FAKE.setBoolean(stack, true);
eiobox.get().horizontal(eiobox.center()).item(stack).vertical(eiobox.getProbeinfo().defaultLayoutStyle().spacing(-1)).text(content1).text(content2);
}
} else {
eiobox.addMore();
}
}
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class TankItemFluidCapability method drain.
@Override
@Nullable
public FluidStack drain(int maxDrain, boolean doDrain) {
if (container.getCount() != 1) {
return null;
}
SmartTank tank = EnumTankType.loadTank(container);
FluidStack ret = tank.drain(maxDrain, doDrain);
EnumTankType.saveTank(container, tank);
return ret;
}
Aggregations