use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class FusedQuartzItemRenderMapper method mapItemDynamicOverlayRender.
@Override
@SideOnly(Side.CLIENT)
public ItemQuadCollector mapItemDynamicOverlayRender(@Nonnull Block block, @Nonnull ItemStack stack) {
if (NbtValue.FAKE.hasTag(stack)) {
// this is for the TOP overlay, kind of a hack putting it here, but the alternative would be adding a new item just for this...
SmartTank tank = ItemTankHelper.getTank(stack);
HalfBakedList buffer = TankRenderHelper.mkTank(tank, 0, 0, 16, true);
if (buffer != null) {
ItemQuadCollector result = new ItemQuadCollector();
List<BakedQuad> quads = new ArrayList<BakedQuad>();
buffer.bake(quads);
result.addQuads(null, quads);
return result;
}
}
return null;
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class GuiInventoryPanel method drawGuiContainerBackgroundLayer.
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) {
syncSettingsChange();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
bindGuiTexture();
int sx = guiLeft;
int sy = guiTop;
drawTexturedModalRect(sx + 24, sy, 0, 0, 232, ySize);
drawTexturedModalRect(sx + 24 + 232, sy, 232, 0, 24, 68);
if (craftingHelper != null || getContainer().hasCraftingRecipe()) {
boolean hover = btnRefill.contains(mouseX - sx, mouseY - sy);
int iconX = hover ? (isShiftKeyDown() ? 48 : 24) : 0;
drawTexturedModalRect(sx + btnRefill.x - 2, sy + btnRefill.y - 2, iconX, 232, 24, 24);
}
TileInventoryPanel te = getTileEntity();
int y = sy;
int numStoredRecipes = te.getStoredCraftingRecipes();
if (numStoredRecipes == 1) {
drawTexturedModalRect(sx, y, 227, 225, 28, 30);
y += 30;
} else if (numStoredRecipes > 1) {
drawTexturedModalRect(sx, y, 227, 225, 28, 24);
y += 24;
for (int i = 1; i < numStoredRecipes - 1; i++) {
drawTexturedModalRect(sx, y, 198, 229, 28, 20);
y += 20;
}
drawTexturedModalRect(sx, y, 198, 229, 28, 26);
y += 26;
}
if (numStoredRecipes < TileInventoryPanel.MAX_STORED_CRAFTING_RECIPES && getContainer().hasNewCraftingRecipe()) {
y += 2;
btnAddStoredRecipe.x = 13;
btnAddStoredRecipe.y = y - sy;
btnAddStoredRecipe.width = 12;
btnAddStoredRecipe.height = 14;
boolean hover = btnAddStoredRecipe.contains(mouseX - sx, mouseY - sy);
drawTexturedModalRect(sx + 13, y, 182, hover ? 241 : 225, 15, 14);
} else {
btnAddStoredRecipe.width = 0;
btnAddStoredRecipe.height = 0;
}
SmartTank fuelTank = te.fuelTank;
if (!InvpanelConfig.inventoryPanelFree.get()) {
drawTexturedModalRect(sx + 35, sy + 132, 232, 163, 18, 49);
if (fuelTank.getFluidAmount() > 0) {
RenderUtil.renderGuiTank(fuelTank.getFluid(), fuelTank.getCapacity(), fuelTank.getFluidAmount(), sx + 24 + 12, sy + 133, zLevel, 16, 47);
}
}
final EnderWidget returnButton = te.isExtractionDisabled() ? btnReturnArea.contains(mouseX - sx, mouseY - sy) ? EnderWidget.STOP_BUT_HOVER : EnderWidget.STOP_BUT : btnReturnArea.contains(mouseX - sx, mouseY - sy) ? EnderWidget.RETURN_BUT_HOVER : EnderWidget.RETURN_BUT;
GlStateManager.color(1, 1, 1, 1);
EnderWidget.RETURN_BUT.getMap().render(returnButton, sx + 24 + 7, sy + 72, true);
int headerColor = 0x404040;
int focusedColor = 0x648494;
FontRenderer fr = getFontRenderer();
fr.drawString(headerCrafting, sx + 24 + 7, sy + 6, headerColor);
fr.drawString(te.isExtractionDisabled() ? headerStorage : headerReturn, sx + 24 + 7 + 10, sy + 72, btnReturnArea.contains(mouseX - sx, mouseY - sy) ? focusedColor : headerColor);
fr.drawString(headerInventory, sx + 24 + 38, sy + 120, headerColor);
super.drawGuiContainerBackgroundLayer(par1, mouseX, mouseY);
if (JeiAccessor.isJeiRuntimeAvailable() && btnSync.isSelected()) {
updateFromJEI();
}
view.setDatabase(getDatabase());
view.setItemFilter(te.getItemFilter());
view.updateFilter(tfFilter.getText());
boolean update = view.sortItems();
scrollbar.setScrollMax(Math.max(0, (view.getNumEntries() + GHOST_COLUMNS - 1) / GHOST_COLUMNS - GHOST_ROWS));
if (update || scrollPos != scrollbar.getScrollPos()) {
updateGhostSlots();
}
if (te.isActive()) {
tfFilter.setEnabled(true);
if (!tfFilter.isFocused() && tfFilter.getText().isEmpty()) {
fr.drawString(infoTextFilter, tfFilter.x, tfFilter.y, 0x707070);
}
} else {
tfFilter.setEnabled(false);
setText(tfFilter, "");
fr.drawString(infoTextOffline, tfFilter.x, tfFilter.y, 0x707070);
}
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class TankItemFluidCapability method fill.
@Override
public int fill(FluidStack resource, boolean doFill) {
if (container.getCount() != 1) {
return 0;
}
SmartTank tank = EnumTankType.loadTank(container);
int ret = tank.fill(resource, doFill);
EnumTankType.saveTank(container, tank);
return ret;
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class TankItemFluidCapability method drain.
@Override
@Nullable
public FluidStack drain(FluidStack resource, boolean doDrain) {
if (container.getCount() != 1) {
return null;
}
SmartTank tank = EnumTankType.loadTank(container);
FluidStack ret = tank.drain(resource, doDrain);
EnumTankType.saveTank(container, tank);
return ret;
}
use of com.enderio.core.common.fluid.SmartTank in project EnderIO by SleepyTrousers.
the class TankItemRenderMapper method mapItemDynamicOverlayRender.
@Override
@SideOnly(Side.CLIENT)
public ItemQuadCollector mapItemDynamicOverlayRender(@Nonnull Block block, @Nonnull ItemStack stack) {
ItemQuadCollector result = new ItemQuadCollector();
if (stack.hasTagCompound()) {
SmartTank tank = ItemTankHelper.getTank(stack);
HalfBakedList buffer = TankRenderHelper.mkTank(tank, 0.5, 0.5, 15.5, false);
if (buffer != null) {
List<BakedQuad> quads = new ArrayList<BakedQuad>();
buffer.bake(quads);
result.addQuads(null, quads);
}
}
if (!NbtValue.FAKE.hasTag(stack)) {
result.addBlockState(block.getStateFromMeta(stack.getMetadata()).withProperty(EnumRenderMode.RENDER, EnumRenderMode.FRONT_ON), stack, true);
}
return result;
}
Aggregations