Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package uk.co.rascagneres.gasmod.gui;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.renderer.texture.TextureAtlasSprite;
- import net.minecraft.client.renderer.texture.TextureMap;
- import net.minecraft.client.resources.I18n;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.init.Blocks;
- import net.minecraft.inventory.Container;
- import net.minecraft.inventory.IInventory;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.fluids.Fluid;
- import org.w3c.dom.css.Rect;
- import uk.co.rascagneres.gasmod.container.GasGeneratorContainer;
- import uk.co.rascagneres.gasmod.tileentity.GasGeneratorOneTE;
- import java.awt.*;
- import java.util.*;
- import static net.minecraft.client.renderer.GlStateManager.color;
- /**
- * Created by Isaac on 23/01/2017.
- */
- public class GasGeneratorOneGui extends GuiContainer{
- private GasGeneratorOneTE gasGeneratorOneTE;
- private IInventory playerInv;
- protected Rectangle fluidBar = new Rectangle(152, 23, 16, 47);
- public GasGeneratorOneGui(Container inventorySlotsIn) {
- super(inventorySlotsIn);
- this.xSize = 176;
- this.ySize = 186;
- }
- public GasGeneratorOneGui(InventoryPlayer inventory, GasGeneratorOneTE tileEntity) {
- this(new GasGeneratorContainer(inventory, tileEntity));
- gasGeneratorOneTE = tileEntity;
- playerInv = inventory;
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
- int i = (this.width - this.xSize)/2;
- int j = (this.height - this.ySize)/2;
- color(1.0f, 1.0f, 1.0f, 1.0f);
- this.mc.getTextureManager().bindTexture(new ResourceLocation("gasmod:textures/gui/container/gas_generator_one_gui.png"));
- this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
- //Draw fluid
- Fluid fluid = gasGeneratorOneTE.getFluidType();
- TextureAtlasSprite fluidTexture = mc.getTextureMapBlocks().getTextureExtry(fluid.getStill().toString());
- mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
- int fluidHeight = gasGeneratorOneTE.getFluidGuiHeight(fluidBar.height);
- drawTexturedModalRect(fluidBar.x + guiLeft, fluidBar.y + guiTop + (fluidBar.height - fluidHeight), fluidTexture, fluidBar.width, fluidHeight);
- //Draw lines over fluid
- drawTexturedModalRect(fluidBar.x + guiLeft, fluidBar.y + guiTop, 187, 1, fluidBar.width, fluidBar.height);
- }
- @Override
- protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
- int i = (this.width - this.xSize)/2;
- int j = (this.height - this.ySize)/2;
- String s = this.gasGeneratorOneTE.getName();
- this.fontRendererObj.drawString(s, 88 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); //#404040
- this.fontRendererObj.drawString(this.playerInv.getDisplayName().getUnformattedText(), 8, 92, 4210752);
- if(fluidBar.contains(mouseX-guiLeft, mouseY-guiTop));
- java.util.List<String> list = new ArrayList<String>();
- list.add(gasGeneratorOneTE.getFluidType().getUnlocalizedName());
- list.add(gasGeneratorOneTE.gasTank.getFluidAmount() + " mB");
- this.drawHoveringText(list, mouseX -guiLeft, mouseY - guiTop);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement