Guest User

Untitled

a guest
Jan 4th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. package com.gugu42.rcmod;
  2.  
  3. import org.lwjgl.opengl.GL11;
  4.  
  5. import cpw.mods.fml.relauncher.Side;
  6. import cpw.mods.fml.relauncher.SideOnly;
  7.  
  8. import net.minecraft.client.gui.GuiButton;
  9. import net.minecraft.client.gui.inventory.GuiContainer;
  10. import net.minecraft.client.renderer.Tessellator;
  11. import net.minecraft.client.resources.I18n;
  12. import net.minecraft.entity.player.InventoryPlayer;
  13. import net.minecraft.util.ResourceLocation;
  14. import net.minecraft.util.StatCollector;
  15.  
  16. @SideOnly(Side.CLIENT)
  17. public class GuiVendor extends GuiContainer {
  18.  
  19. private static final ResourceLocation texturepath = new ResourceLocation("rcmod", "textures/gui/vendor.png");
  20.  
  21. private GuiButton ammoBtn;
  22.  
  23. public GuiVendor(InventoryPlayer inventoryPlayer,
  24. TileEntityVendor tileEntity) {
  25. // the container is instanciated and passed to the superclass for
  26. // handling
  27. super(new ContainerVendor(inventoryPlayer, tileEntity));
  28. }
  29.  
  30. @Override
  31. public void initGui()
  32. {
  33. this.buttonList.clear();
  34. int posX = (this.width - xSize) / 2;
  35. int posY = (this.height - ySize) / 2;
  36. this.buttonList.add(this.ammoBtn = new GuiButton(0, posX + 13, posY + 15, "cc"));
  37.  
  38. }
  39.  
  40. @Override
  41. protected void drawGuiContainerForegroundLayer(int param1, int param2) {
  42. // draw text and stuff here
  43. // the parameters for drawString are: string, x, y, color
  44. fontRenderer.drawString("Vendor", 8, 6, 4210752);
  45. // draws "Inventory" or your regional equivalent
  46. fontRenderer.drawString(
  47. StatCollector.translateToLocal("container.inventory"), 8,
  48. ySize - 96 + 2, 4210752);
  49. }
  50.  
  51.  
  52.  
  53. @Override
  54. protected void drawGuiContainerBackgroundLayer(float par1, int par2,
  55. int par3) {
  56. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  57. GL11.glDisable(GL11.GL_LIGHTING);
  58. this.mc.getTextureManager().bindTexture(texturepath);
  59. GL11.glEnable(GL11.GL_BLEND);
  60. GL11.glDisable(GL11.GL_DEPTH_TEST);
  61. GL11.glDepthMask(false);
  62. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
  63. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  64. GL11.glDisable(GL11.GL_ALPHA_TEST);
  65. int x = (width - xSize) / 2;
  66. int y = (height - ySize) / 2;
  67. drawTexturedQuadFit(x, y, 256, 256, 0);
  68. GL11.glEnable(GL11.GL_DEPTH_TEST);
  69. GL11.glDepthMask(true);
  70.  
  71. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  72. GL11.glDisable(GL11.GL_LIGHTING);
  73.  
  74. }
  75.  
  76. @SideOnly(Side.CLIENT)
  77. public static void drawTexturedQuadFit(double x, double y, double width, double height, double zLevel){
  78. Tessellator tessellator = Tessellator.instance;
  79. tessellator.startDrawingQuads();
  80. tessellator.addVertexWithUV(x + 0, y + height, zLevel, 0,1);
  81. tessellator.addVertexWithUV(x + width, y + height, zLevel, 1, 1);
  82. tessellator.addVertexWithUV(x + width, y + 0, zLevel, 1,0);
  83. tessellator.addVertexWithUV(x + 0, y + 0, zLevel, 0, 0);
  84. tessellator.draw();
  85. }
  86.  
  87.  
  88. }
Advertisement
Add Comment
Please, Sign In to add comment