Guest User

GuiBarrel

a guest
Jul 29th, 2019
652
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.51 KB | None | 0 0
  1. package com.konarjg.arcticraft.blocks.tileentities.gui;
  2.  
  3. import com.konarjg.arcticraft.init.ModBlocks;
  4. import com.konarjg.arcticraft.util.Reference;
  5.  
  6. import net.minecraft.client.gui.inventory.GuiContainer;
  7. import net.minecraft.client.renderer.GlStateManager;
  8. import net.minecraft.client.resources.I18n;
  9. import net.minecraft.entity.player.EntityPlayer;
  10. import net.minecraft.entity.player.InventoryPlayer;
  11. import net.minecraft.inventory.Container;
  12. import net.minecraft.util.ResourceLocation;
  13.  
  14. public class GuiBarrel extends GuiContainer {
  15.  
  16.     private InventoryPlayer playerInv;
  17.     private static final ResourceLocation BG_TEXTURE = new ResourceLocation(Reference.MOD_ID, "textures/gui/barrel.png");
  18.  
  19.     public GuiBarrel(Container inventorySlotsIn, InventoryPlayer playerInv) {
  20.         super(inventorySlotsIn);
  21.         this.playerInv = playerInv;
  22.     }
  23.  
  24.     @Override
  25.     protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
  26.         GlStateManager.color(1, 1, 1, 1);
  27.         mc.getTextureManager().bindTexture(BG_TEXTURE);
  28.         int x = (width - xSize) / 2;
  29.         int y = (height - ySize) / 2;
  30.         drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
  31.     }
  32.    
  33.     @Override
  34.     protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
  35.         String name = I18n.format(ModBlocks.BARREL.getUnlocalizedName() + ".name");
  36.         fontRenderer.drawString(name, xSize / 2 - fontRenderer.getStringWidth(name) / 2, 10, 0x404040);
  37.         fontRenderer.drawString(playerInv.getDisplayName().getUnformattedText(), 8, ySize - 94, 0x404040);
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment