IndustrialElectrolyzer now uses fluids

IndustrialElectrolyzer now renders fluids in gui
IndustrialElectrolyzer recipe handler now renders fluids
This commit is contained in:
Gig 2015-06-26 17:56:09 +01:00
parent 6cc1071961
commit 6e74b9197b
6 changed files with 175 additions and 15 deletions

View file

@ -5,7 +5,7 @@ import net.minecraft.inventory.Slot;
import techreborn.client.SlotOutput;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class ContainerIndustrialElectrolyzer extends TechRebornContainer {
public class ContainerIndustrialElectrolyzer extends ContainerCrafting {
EntityPlayer player;
@ -19,9 +19,9 @@ public class ContainerIndustrialElectrolyzer extends TechRebornContainer {
public int tickTime;
public ContainerIndustrialElectrolyzer(TileIndustrialElectrolyzer electrolyzer,
EntityPlayer player)
public ContainerIndustrialElectrolyzer(TileIndustrialElectrolyzer electrolyzer, EntityPlayer player)
{
super(electrolyzer.crafter);
tile = electrolyzer;
this.player = player;
@ -38,7 +38,6 @@ public class ContainerIndustrialElectrolyzer extends TechRebornContainer {
int i;
for (i = 0; i < 3; ++i)
{
for (int j = 0; j < 9; ++j)

View file

@ -1,18 +1,22 @@
package techreborn.client.gui;
import ic2.core.util.DrawUtil;
import codechicken.lib.gui.GuiDraw;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import techreborn.client.container.ContainerIndustrialElectrolyzer;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileIndustrialElectrolyzer;
public class GuiIndustrialElectrolyzer extends GuiContainer {
private static final ResourceLocation texture = new ResourceLocation(
"techreborn", "textures/gui/industrial_electrolyzer.png");
private static final ResourceLocation texture = new ResourceLocation("techreborn", "textures/gui/industrial_electrolyzer.png");
TileIndustrialElectrolyzer eletrolyzer;
@ -27,22 +31,39 @@ public class GuiIndustrialElectrolyzer extends GuiContainer {
@Override
public void initGui() {
this.buttonList.clear();
// this.buttonList.clear();
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.buttonList.add(new GuiButton(0, k + 4, l + 4, 20, 20, "R"));
// this.buttonList.add(new GuiButton(0, k + 4, l + 4, 20, 20, "R"));
super.initGui();
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_,
int p_146976_2_, int p_146976_3_)
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
this.mc.getTextureManager().bindTexture(texture);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
if (eletrolyzer.tank.getFluidAmount() != 0)
{
IIcon fluidIcon = eletrolyzer.tank.getFluid().getFluid().getIcon();
if (fluidIcon != null)
{
drawTexturedModalRect(k + 7, l + 15, 176, 31, 20, 55);
this.mc.renderEngine
.bindTexture(TextureMap.locationBlocksTexture);
int liquidHeight = eletrolyzer.tank.getFluidAmount() * 47
/ eletrolyzer.tank.getCapacity();
DrawUtil.drawRepeated(fluidIcon, k + 11, l + 19 + 47
- liquidHeight, 12.0D, liquidHeight, this.zLevel);
this.mc.renderEngine.bindTexture(texture);
drawTexturedModalRect(k + 11, l + 19, 176, 86, 12, 47);
}
}
}
protected void drawGuiContainerForegroundLayer(int p_146979_1_,