public void exitWithoutUpdate() { mc.displayGuiScreen(null); stand.hatName = prevHatName; stand.colourR = prevColourR; stand.colourG = prevColourG; stand.colourB = prevColourB; stand.head = prevHead; stand.gameProfile = prevGameProfile; stand.hasBase = prevBase; stand.hasStand = prevStandPost; stand.getWorld().markBlockForUpdate(stand.getPos()); }
@Override public void onGuiClosed() { if (!confirmed) { stand.hatName = prevHatName; stand.colourR = prevColourR; stand.colourG = prevColourG; stand.colourB = prevColourB; stand.alpha = prevAlpha; stand.head = prevHead; stand.gameProfile = prevGameProfile; stand.hasBase = prevBase; stand.hasStand = prevStandPost; stand.getWorld().markBlockForUpdate(stand.getPos()); } Keyboard.enableRepeatEvents(false); }
public void randomize() { if (view == VIEW_HATS) { if (hatsToShow.size() > 0) { int randVal = rand.nextInt(hatsToShow.size()); String hatName = (String) hatsToShow.get(randVal); stand.hatName = hatName.toLowerCase(); colourR = colourG = colourB = alpha = 255; stand.colourR = 255; stand.colourG = 255; stand.colourB = 255; stand.alpha = 255; pageNumber = randVal / 6; if (isShiftKeyDown()) { view = VIEW_COLOURIZER; updateButtonList(); randomizeColour(); view = VIEW_HATS; } updateButtonList(); } } else if (view == VIEW_COLOURIZER) { if (isShiftKeyDown()) { colourR = colourG = colourB = alpha = 255; stand.colourR = 255; stand.colourG = 255; stand.colourB = 255; stand.alpha = 255; updateButtonList(); } else { randomizeColour(); } } }
public void removeHat() { stand.hatName = ""; updateButtonList(); }
@Override protected void actionPerformed(GuiButton btn) { if (!justClickedButton) { if (btn.id == ID_DONE_SELECT) { exitAndUpdate(); } if (btn.id == ID_PAGE_LEFT) { switchPage(true); } else if (btn.id == ID_PAGE_RIGHT) { switchPage(false); } else if (btn.id == ID_CLOSE) { exitWithoutUpdate(); } else if (btn.id == ID_NONE) { removeHat(); } else if (btn.id == ID_HAT_COLOUR_SWAP) { toggleHatsColourizer(); } else if (btn.id == ID_RANDOM) { randomize(); } else if (btn.id == ID_HEAD) { stand.head++; if (stand.head == TileEntityHatStand.headNames.length) { stand.head = 0; } if (stand.head == 4) { stand.gameProfile = Minecraft.getMinecraft().thePlayer.getGameProfile(); } head = stand.head; justClickedButton = true; updateButtonList(); } else if (btn.id == ID_BASE) { base = !base; stand.hasBase = base; justClickedButton = true; if (!base) { stand.hasStand = standPost = false; } stand.getWorld().markBlockForUpdate(stand.getPos()); updateButtonList(); } else if (btn.id == ID_STAND) { standPost = !standPost; stand.hasStand = standPost; justClickedButton = true; stand.getWorld().markBlockForUpdate(stand.getPos()); updateButtonList(); } else if (btn.id >= ID_HAT_START_ID) { justClickedButton = true; stand.hatName = btn.displayString.toLowerCase(); colourR = colourG = colourB = alpha = 255; stand.colourR = 255; stand.colourG = 255; stand.colourB = 255; stand.alpha = 255; updateButtonList(); } } }