Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package us.xvicario.rpglevel.gui;
- import java.io.ByteArrayOutputStream;
- import java.io.DataOutputStream;
- import org.lwjgl.opengl.GL11;
- import us.xvicario.rpglevel.RPGLevel;
- import us.xvicario.rpglevel.TileEntityLevelUpStation;
- import net.minecraft.client.Minecraft;
- import net.minecraft.client.gui.GuiButton;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.resources.I18n;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.inventory.Container;
- import net.minecraft.item.ItemStack;
- import net.minecraft.network.packet.Packet250CustomPayload;
- import net.minecraft.util.ResourceLocation;
- public class LevelUpStationGUI extends GuiContainer {
- public static final ResourceLocation textureGUI = new ResourceLocation("rpglevel", "textures/gui/levelUpGui.png");
- public TileEntityLevelUpStation levelUpStation;
- public static EntityPlayer player;
- public LevelUpStationGUI(EntityPlayer player,InventoryPlayer inventoryPlayer, TileEntityLevelUpStation entity) {
- super(new LevelUpStationContainer(inventoryPlayer,entity));
- this.levelUpStation = entity;
- this.player = player;
- this.xSize = 176;
- this.ySize = 166;
- }
- public void drawGuiContainerForegroundLayer(int par1, int par2) {
- String name = this.levelUpStation.isInvNameLocalized() ? this.levelUpStation.getInvName() : I18n.getString(this.levelUpStation.getInvName());
- this.fontRenderer.drawString(name, this.xSize / 2 - this.fontRenderer.getStringWidth(name) / 2, 6, 4210752);
- this.fontRenderer.drawString(I18n.getString("container.inventory"), 8, this.ySize-96+2, 4210752);
- }
- @Override
- public void drawGuiContainerBackgroundLayer(float f, int i, int j) {
- GL11.glColor4f(1f, 1f, 1f, 1f);
- //int texture = mc.renderEngine.getTexture("/gui/levelUpGui.png");
- //this.mc.renderEngine.bindTexture(texture);
- this.mc.renderEngine.bindTexture(textureGUI);
- this.buttonList.add(new GuiButton(0,guiLeft+8,this.ySize-112,20,20, "Mining"));
- this.buttonList.add(new GuiButton(1,guiLeft+8,this.ySize-90,20,20, "Attack"));
- this.buttonList.add(new GuiButton(2,guiLeft+30,this.ySize-112,20,20, "Defense"));
- this.buttonList.add(new GuiButton(3,guiLeft+30,this.ySize-90,20,20, "Archery"));
- //new GuiButton()
- drawTexturedModalRect((width-xSize)/2,(height-ySize)/2,0,0,xSize,ySize);
- }
- public void actionPerformed(GuiButton button) {
- if (this.player.experienceLevel >= 20) {
- ItemStack levelUpBook;
- switch(button.id) {
- case 0:
- levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,0);
- this.levelUpStation.setInventorySlotContents(0, levelUpBook);
- break;
- case 1:
- levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,1);
- this.levelUpStation.setInventorySlotContents(0, levelUpBook);
- break;
- case 2:
- levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,2);
- this.levelUpStation.setInventorySlotContents(0,levelUpBook);
- break;
- case 3:
- levelUpBook = new ItemStack(RPGLevel.itemLevelUpBook,1,3);
- this.levelUpStation.setInventorySlotContents(0, levelUpBook);
- break;
- }
- this.player.addExperienceLevel(this.player.experienceLevel-10);
- this.levelUpStation.onInventoryChanged();
- }
- }
- private void sendPacket() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment