Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (isHovering(x, y) && type == 1) {
- Minecraft.getMinecraft().sndManager.playSoundFX("random.click",
- 1.0F, 1.0F);
- Frame frame = new Frame(getMod().getName(), 0, 2, Minecraft.gm) {
- @Override
- public void init() {
- Set set = getMod().getLoadedSettings().entrySet();
- Iterator iterator = set.iterator();
- while (iterator.hasNext()) {
- final Map.Entry entry = (Map.Entry) iterator.next();
- ModValue value = (ModValue) entry.getValue();
- if (value.getName().equalsIgnoreCase("N/A"))
- continue;
- if (value.getValue() instanceof Integer
- || value.getValue() instanceof Double
- || value.getValue() instanceof Long
- || value.getValue() instanceof Float)
- addComponent(new Slider(value.getName().replace(
- getMod().getName() + " ", ""), 0, 0,
- getWidth() - 6, 12, getMod(),
- value.getMax(), (Integer) entry.getKey()));
- if (value.getValue() instanceof Boolean)
- addComponent(new Button(value.getName().replace(
- getMod().getName() + " ", ""), 0, 0,
- getWidth() - 6, 12) {
- @Override
- public void init() {
- setState((Boolean) getMod().getSetting(
- (Integer) entry.getKey()));
- }
- @Override
- public void mouseClicked(final int x,
- final int y, final int type) {
- if (isHovering(x, y) && type == 0) {
- Minecraft.getMinecraft().sndManager
- .playSoundFX("random.click",
- 0.5F, 1.0F);
- setState(!(Boolean) getMod()
- .getSetting(
- (Integer) entry
- .getKey()));
- getMod().registerSetting(
- (Integer) entry.getKey(),
- (Object) getState(),
- (String) ((ArrayHelper) entry
- .getValue()).getValue(),
- 0.0D, true, true);
- }
- }
- });
- }
- addComponent(new Button("Keybind: " + getMod().getKey(), 0,
- 0, getWidth() - 6, 12) {
- private boolean keyTyped = false;
- @Override
- public void mouseClicked(final int x, final int y,
- final int type) {
- if (isHovering(x, y) && type == 0) {
- Minecraft.getMinecraft().sndManager
- .playSoundFX("random.click", 1.0F, 1.0F);
- setText("Keybind: *");
- setKeyTyped(!isKeyTyped());
- }
- if (isHovering(x, y) && type == 2) {
- Minecraft.getMinecraft().sndManager
- .playSoundFX("random.click", 1.0F, 1.0F);
- getMod().setKey("NONE", true);
- setText("Keybind: " + getMod().getKey());
- setKeyTyped(false);
- }
- }
- @Override
- public void keyTyped(final String keyName,
- final char keyChar) {
- if (isKeyTyped()
- && !keyName.equalsIgnoreCase("ESCAPE")) {
- Minecraft.getMinecraft().sndManager
- .playSoundFX("random.click", 1.0F, 1.0F);
- getMod().setKey(keyName, true);
- setText("Keybind: " + getMod().getKey());
- setKeyTyped(false);
- }
- }
- public boolean isKeyTyped() {
- return keyTyped;
- }
- public void setKeyTyped(final boolean keyTyped) {
- this.keyTyped = keyTyped;
- }
- });
- }
- };
- if (!Minecraft.gm.getFrames().containsByName(frame.getText()))
- Minecraft.gm.getFrames().addFrame(frame);
- else if (Minecraft.gm.getFrames().containsByName(frame.getText()))
- Minecraft.gm.getFrames().removeFrameByName(frame.getText());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement