Example #1
0
 @Override
 public void onChangeSliderValue(GuiSlider slider) {
   if (slider.id == 5) {
     colourR =
         (int)
             Math.round(
                 slider.sliderValue * (slider.maxValue - slider.minValue) + slider.minValue);
     stand.colourR = colourR;
   } else if (slider.id == 6) {
     colourG =
         (int)
             Math.round(
                 slider.sliderValue * (slider.maxValue - slider.minValue) + slider.minValue);
     stand.colourG = colourG;
   } else if (slider.id == 7) {
     colourB =
         (int)
             Math.round(
                 slider.sliderValue * (slider.maxValue - slider.minValue) + slider.minValue);
     stand.colourB = colourB;
   } else if (slider.id == 15) {
     alpha =
         (int)
             Math.round(
                 slider.sliderValue * (slider.maxValue - slider.minValue) + slider.minValue);
     stand.alpha = alpha;
   }
 }
Example #2
0
  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();
      }
    }
  }
Example #3
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 #4
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 #5
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();
      }
    }
  }