Guest User

Untitled

a guest
Jan 9th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. package us.xvicario.rpglevel.gui;
  2.  
  3. import java.io.ByteArrayOutputStream;
  4. import java.io.DataOutputStream;
  5.  
  6. import org.lwjgl.opengl.GL11;
  7.  
  8. import us.xvicario.rpglevel.RPGLevel;
  9. import us.xvicario.rpglevel.TileEntityLevelUpStation;
  10. import net.minecraft.client.Minecraft;
  11. import net.minecraft.client.gui.GuiButton;
  12. import net.minecraft.client.gui.inventory.GuiContainer;
  13. import net.minecraft.client.resources.I18n;
  14. import net.minecraft.entity.player.EntityPlayer;
  15. import net.minecraft.entity.player.InventoryPlayer;
  16. import net.minecraft.inventory.Container;
  17. import net.minecraft.item.ItemStack;
  18. import net.minecraft.network.packet.Packet250CustomPayload;
  19. import net.minecraft.util.ResourceLocation;
  20.  
  21. public class LevelUpStationGUI extends GuiContainer {
  22.  
  23. public static final ResourceLocation textureGUI = new ResourceLocation("rpglevel", "textures/gui/levelUpGui.png");
  24. public TileEntityLevelUpStation levelUpStation;
  25. public static EntityPlayer player;
  26.  
  27. public LevelUpStationGUI(EntityPlayer player,InventoryPlayer inventoryPlayer, TileEntityLevelUpStation entity) {
  28. super(new LevelUpStationContainer(inventoryPlayer,entity));
  29. this.levelUpStation = entity;
  30. this.player = player;
  31. this.xSize = 176;
  32. this.ySize = 166;
  33. }
  34.  
  35. public void drawGuiContainerForegroundLayer(int par1, int par2) {
  36. String name = this.levelUpStation.isInvNameLocalized() ? this.levelUpStation.getInvName() : I18n.getString(this.levelUpStation.getInvName());
  37. this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6, 4210752);
  38. this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize-96+2, 4210752);
  39. }
  40.  
  41. @Override
  42. public void drawGuiContainerBackgroundLayer(float f, int i, int j) {
  43. GL11.glColor4f(1f, 1f, 1f, 1f);
  44. //int texture = mc.renderEngine.getTexture("/gui/levelUpGui.png");
  45. //this.mc.renderEngine.bindTexture(texture);
  46. this.mc.renderEngine.bindTexture(textureGUI);
  47. this.buttonList.add(new GuiButton(0,guiLeft+8,this.ySize-112,20,20, "Mining"));
  48. this.buttonList.add(new GuiButton(1,guiLeft+8,this.ySize-90,20,20, "Attack"));
  49. this.buttonList.add(new GuiButton(2,guiLeft+30,this.ySize-112,20,20, "Defense"));
  50. this.buttonList.add(new GuiButton(3,guiLeft+30,this.ySize-90,20,20, "Archery"));
  51. //new GuiButton()
  52. drawTexturedModalRect((width-xSize)/2,(height-ySize)/2,0,0,xSize,ySize);
  53. }
  54.  
  55. public void actionPerformed(GuiButton button) {
  56. if (this.player.experienceLevel >= 20) {
  57. ItemStack levelUpBook;
  58. switch(button.id) {
  59. case 0:
  60. levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,0);
  61. this.levelUpStation.setInventorySlotContents(0, levelUpBook);
  62. break;
  63. case 1:
  64. levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,1);
  65. this.levelUpStation.setInventorySlotContents(0, levelUpBook);
  66. break;
  67. case 2:
  68. levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,2);
  69. this.levelUpStation.setInventorySlotContents(0,levelUpBook);
  70. break;
  71. case 3:
  72. levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,3);
  73. this.levelUpStation.setInventorySlotContents(0, levelUpBook);
  74. break;
  75. }
  76. this.player.addExperienceLevel(this.player.experienceLevel-10);
  77. this.levelUpStation.onInventoryChanged();
  78. }
  79. }
  80.  
  81. private void sendPacket() {
  82.  
  83. }
  84.  
  85. }
Advertisement
Add Comment
Please, Sign In to add comment