Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.awt.image.BufferedImage;
- import org.lwjgl.opengl.GL11;
- public class GuiChooseName extends GuiScreen {
- private BufferedImage img;
- private int imgID = 1000;
- public GuiChooseName(EntityGorilla entity)
- {
- mob=entity;
- }
- private GuiTextField textfield;
- public EntityGorilla mob;
- public void initGui() {
- try {
- img = ModLoader.loadImage(mc.renderEngine, "/TameCraft/ChooseName.png");
- mc.renderEngine.setupTexture(img, imgID);
- } catch (Exception e) {
- e.printStackTrace();
- }
- controlList.clear();
- controlList.add(new GuiButton(1, width / 2 - 49, height / 2 + 20, 70, 20, "Enter"));
- textfield = new GuiTextField(this, fontRenderer, width / 2 - 87, height / 2 - 10, 150, 20, "");
- textfield.isFocused = false;
- textfield.setMaxStringLength(16);
- }
- protected void actionPerformed(GuiButton guibutton)
- {
- if(guibutton.id == 1)
- {
- mob.Name = textfield.getText();
- mc.displayGuiScreen(null);
- }
- }
- protected void keyTyped(char c, int i)
- {
- super.keyTyped(c, i);
- textfield.textboxKeyTyped(c, i);
- }
- protected void mouseClicked(int i, int j, int k)
- {
- super.mouseClicked(i, j, k);
- textfield.mouseClicked(i, j, k);
- }
- public boolean doesGuiPauseGame()
- {
- return false;
- }
- public void onGuiClosed()
- {
- }
- public void drawScreen(int i, int j, float f)
- {
- drawDefaultBackground();
- int k = width / 2 - 100;
- int l = height / 2 - 40;
- try {
- int tempvar = mc.renderEngine.getTexture("/mods/name.png");
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- mc.renderEngine.bindTexture(tempvar);
- drawTexturedModalRect(k, l, 0, 0, 176, 166);
- }
- finally {
- }
- textfield.drawTextBox();
- drawCenteredString(fontRenderer, "Enter the Name of your Mob", width / 2 - 10, height / 2 - 35, 0xffffff);
- super.drawScreen(i, j, f);
- }
- }
Add Comment
Please, Sign In to add comment