Guest User

LegendaryRumourGui with weird button

a guest
Jan 2nd, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.36 KB | None | 0 0
  1. package com.troglodytegames.mods.legendofartisans.guis;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.client.gui.GuiButton;
  6. import net.minecraft.client.gui.GuiLabel;
  7. import net.minecraft.client.gui.GuiScreen;
  8. import net.minecraft.init.Items;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.util.ResourceLocation;
  11.  
  12. import org.lwjgl.opengl.GL11;
  13.  
  14. import com.troglodytegames.mods.legendofartisans.LegendOfArtisansMod;
  15.  
  16. public class LegendaryRumourGui extends GuiScreen {
  17.  
  18.     public static final int GUI_ID = 20;
  19.  
  20.     private static final int CLOSE_BUTTON_ID = 0;
  21.    
  22.     private ResourceLocation backgroundTexture;
  23.    
  24.     public LegendaryRumourGui() {  
  25.         backgroundTexture = new ResourceLocation(LegendOfArtisansMod.MODID,"textures/gui/legendaryrumourgui.png");
  26.     }
  27.        
  28.     @Override
  29.     public void initGui() {
  30.         super.initGui();
  31.         GuiButton closeButton = new GuiButton(CLOSE_BUTTON_ID,
  32.                 (width / 2) - 25 - 10, height - 27, 50, 20, "Close");
  33.         buttonList.add(closeButton);
  34.     }
  35.    
  36.     @Override
  37.     public boolean doesGuiPauseGame() {
  38.         return false;
  39.     }
  40.    
  41.     @Override
  42.     protected void actionPerformed(GuiButton button) {
  43.         if (button.id == CLOSE_BUTTON_ID) {
  44.             this.mc.displayGuiScreen((GuiScreen)null);
  45.             return;
  46.         }
  47.     }
  48.    
  49.     /**
  50.      * Draws the screen and all the components in it.
  51.      */
  52.     public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
  53.     {
  54.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  55.         this.mc.getTextureManager().bindTexture(backgroundTexture);
  56.         this.drawTexturedModalRect( (this.width - 256) / 2, 0, 0, 0, 256, 256);
  57.         drawShapelessCrafting((this.width - 100) / 2, 180, LegendOfArtisansMod.legendarybookShapeless);
  58.         for (int k = 0; k < this.buttonList.size(); ++k)
  59.         {
  60.             ((GuiButton)this.buttonList.get(k)).drawButton(this.mc, p_73863_1_, p_73863_2_);
  61.         }
  62.  
  63.         for (int k = 0; k < this.labelList.size(); ++k)
  64.         {
  65.             ((GuiLabel)this.labelList.get(k)).func_146159_a(this.mc, p_73863_1_, p_73863_2_);
  66.         }
  67.     }
  68.  
  69.     protected void drawShapelessCrafting(int x, int y, List<ItemStack> stacks) {
  70.        
  71.         int offset = 0;
  72.         for (ItemStack stack : stacks) {
  73.             itemRender.renderItemIntoGUI(fontRendererObj, this.mc.getTextureManager(), stack, x + offset, y);
  74.             offset = offset + 30;
  75.         }
  76.     }
  77.    
  78. }
Advertisement
Add Comment
Please, Sign In to add comment