Example #1
0
  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());
  }
Example #2
0
  @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);
  }
Example #3
0
  @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();
      }
    }
  }