Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.28 KB | None | 0 0
  1. import eu.mprom.gm.achievements.GMAchievements;
  2. import net.minecraft.client.Minecraft;
  3. import net.minecraft.client.gui.FontRenderer;
  4. import net.minecraft.client.gui.GuiButton;
  5. import net.minecraft.client.gui.GuiScreen;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.util.ResourceLocation;
  8. import org.lwjgl.opengl.GL11;
  9.  
  10. import java.util.ArrayList;
  11.  
  12. public class GuiAchievements extends GuiScreen {
  13.  
  14.     protected int guiWidth = 256;
  15.     protected int guiHeight = 200;
  16.  
  17.     private ArrayList<String> achievements;
  18.     private GuiSlotAchievement achievementsList;
  19.  
  20.     private EntityPlayer player;
  21.  
  22.     public GuiAchievements(EntityPlayer player) {
  23.         this.player = player;
  24.  
  25.         achievements = new ArrayList<String>();
  26.         for (int i = 0; i < 10; i++) {
  27.             achievements.add("Achv " + i);
  28.         }
  29.     }
  30.  
  31.     @Override
  32.     public void initGui() {
  33.         super.initGui();
  34.  
  35.         int guiX = (width - guiWidth) / 2;
  36.         int guiY = (height - guiHeight) / 2;
  37.  
  38.         //this.buttonList.add( new GuiButton(1, guiX + 9, guiY + 148, 50, 15, "Close"));
  39.  
  40.         this.achievementsList = new GuiSlotAchievement(this, achievements);
  41.         this.achievementsList.registerScrollButtons(this.buttonList, 7, 8);
  42.     }
  43.  
  44.     @Override
  45.     public void drawScreen(int x, int y, float ticks) {
  46.  
  47.         int guiX = (width - guiWidth) / 2;
  48.         int guiY = (height - guiHeight) / 2;
  49.  
  50.         mc.renderEngine.bindTexture(new ResourceLocation(GMAchievements.MOD_ID, "textures/gui/achievements.png"));
  51.         drawTexturedModalRect(guiX, guiY, 0, 0, 256, 200);
  52.  
  53.     // This draws the scrolling list
  54.         this.achievementsList.drawScreen(x, y, ticks);
  55.  
  56.     // I tried to put this before and after drawing the scrolling list - no difference - no result
  57.         boolean gl = GL11.glGetBoolean(GL11.GL_SCISSOR_TEST);
  58.         if(!gl) GL11.glEnable(GL11.GL_SCISSOR_TEST);
  59.         GL11.glPushAttrib(GL11.GL_SCISSOR_BIT);
  60.         GL11.glScissor(x, y, 240, 160);
  61.         GL11.glDisable(GL11.GL_SCISSOR_TEST);
  62.  
  63.         this.drawCenteredString(this.fontRendererObj, "Glowing Mines Achievements", this.width / 2, 10, 0xFFFFFF);
  64.  
  65.  
  66.         //GL11.glColor4f(1, 1, 1, 1);
  67.         //drawDefaultBackground();
  68.  
  69.         super.drawScreen(x, y, ticks);
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement