cosmetic menu

This commit is contained in:
Rxn69 2023-06-29 15:55:14 +05:30
parent 0a42ede460
commit c2c09e505f
8 changed files with 1266 additions and 3483 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ public enum Category {
MACROS("MACROS", "Athena/gui/mods/cps.png"), MACROS("MACROS", "Athena/gui/mods/cps.png"),
WAYPOINTS("WAYPOINTS", "Athena/gui/menu/waypoints.png"), WAYPOINTS("WAYPOINTS", "Athena/gui/menu/waypoints.png"),
PROFILES("PROFILES", "Athena/gui/menu/profiles.png"), PROFILES("PROFILES", "Athena/gui/menu/profiles.png"),
CAPES("CAPES", "Athena/gui/menu/cosmetics.png"), COSMETICS("COSMETICS", "Athena/gui/menu/cosmetics.png"),
//COSMETICS("COSMETICS", "Athena/gui/menu/cosmetics.png"), //COSMETICS("COSMETICS", "Athena/gui/menu/cosmetics.png"),
THEMES("THEMES", "Athena/gui/menu/themes.png"); THEMES("THEMES", "Athena/gui/menu/themes.png");

View File

@ -28,13 +28,15 @@ public class PageManager {
private void init() { private void init() {
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
pages.put(Category.MODS, new ModsPage(mc, menu, parent)); pages.put(Category.MODS, new ModsPage(mc, menu, parent));
pages.put(Category.SETTINGS, new SettingsPage(mc, menu, parent)); pages.put(Category.SETTINGS, new SettingsPage(mc, menu, parent));
pages.put(Category.MACROS, new MacrosPage(mc, menu, parent)); pages.put(Category.MACROS, new MacrosPage(mc, menu, parent));
pages.put(Category.WAYPOINTS, new WaypointsPage(mc, menu, parent)); pages.put(Category.WAYPOINTS, new WaypointsPage(mc, menu, parent));
pages.put(Category.PROFILES, new ProfilesPage(mc, menu, parent)); pages.put(Category.PROFILES, new ProfilesPage(mc, menu, parent));
//pages.put(Category.COSMETICS, new CosmeticsPage(mc, menu, parent)); //pages.put(Category.COSMETICS, new CosmeticsPage(mc, menu, parent));
pages.put(Category.CAPES, new CapesPage(mc, menu, parent)); pages.put(Category.COSMETICS, new CosmeticsPage(mc, menu, parent));
pages.put(Category.THEMES, new ThemesPage(mc, menu, parent)); pages.put(Category.THEMES, new ThemesPage(mc, menu, parent));
} }

View File

@ -1,9 +1,11 @@
package rip.athena.client.gui.clickgui.components.cosmetics; package rip.athena.client.gui.clickgui.components.cosmetics;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import rip.athena.client.Athena;
import rip.athena.client.gui.framework.draw.ButtonState; import rip.athena.client.gui.framework.draw.ButtonState;
import rip.athena.client.gui.framework.draw.DrawType; import rip.athena.client.gui.framework.draw.DrawType;
import rip.athena.client.gui.clickgui.components.macros.MacroButton; import rip.athena.client.gui.clickgui.components.macros.MacroButton;
import rip.athena.client.theme.ThemeManager;
import rip.athena.client.utils.render.DrawUtils; import rip.athena.client.utils.render.DrawUtils;
import java.awt.*; import java.awt.*;
@ -58,11 +60,13 @@ public class CosmeticGenericButton extends MacroButton {
//rip.athena.client.gui.framework.draw.DrawImpl.drawRect(x, y, width, height, backgroundColor); //rip.athena.client.gui.framework.draw.DrawImpl.drawRect(x, y, width, height, backgroundColor);
} }
GlStateManager.color(1,1,1); theme = Athena.INSTANCE.getThemeManager().getTheme();
DrawUtils.drawRoundedRect(x, y, x + width, y + height, 4.0f, new Color(50, 50, 50, 255).getRGB());
DrawUtils.drawRoundedRect(x + 1, y + 1, x + width - 1, y + height - 1, 4.0f, lineColor);
/*drawHorizontalLine(x, y, width + 1, 1, lineColor); GlStateManager.color(1,1,1);
DrawUtils.drawRoundedRect(x, y, x + width, y + height, 4.0f, new Color(theme.getFirstColor().getRed(), theme.getFirstColor().getGreen(), theme.getFirstColor().getBlue(), 90).getRGB());
DrawUtils.drawRoundedRect(x + 1, y + 1, x + width - 1, y + height - 1, 4.0f, backgroundColor);
/*drawHorizontalLine(x, y, width + 1, 1, lineColor);
drawVerticalLine(x, y + 1, height - 1, 1, lineColor); drawVerticalLine(x, y + 1, height - 1, 1, lineColor);
drawHorizontalLine(x, y + height, width + 1, 1, lineColor); drawHorizontalLine(x, y + height, width + 1, 1, lineColor);
drawVerticalLine(x + width, y + 1, height - 1, 1, lineColor); drawVerticalLine(x + width, y + 1, height - 1, 1, lineColor);

View File

@ -1,103 +0,0 @@
package rip.athena.client.gui.clickgui.pages;
import net.minecraft.client.Minecraft;
import rip.athena.client.Athena;
import rip.athena.client.cosmetics.cape.Cape;
import rip.athena.client.gui.clickgui.IngameMenu;
import rip.athena.client.gui.clickgui.Page;
import rip.athena.client.gui.clickgui.components.capes.CapeButton;
import rip.athena.client.gui.clickgui.components.mods.ModScrollPane;
import rip.athena.client.gui.framework.Menu;
/**
* @author Athena Development
* @project Athena-Client
* @date 6/2/2023
*/
public class CapesPage extends Page {
private ModScrollPane scrollPane;
public CapesPage(Minecraft mc, Menu menu, IngameMenu parent) {
super(mc, menu, parent);
}
@Override
public void onInit() {
int width = 300;
scrollPane = new ModScrollPane(260, 100, menu.getWidth() - width, menu.getHeight() - 101, false);
populateScrollPane();
}
private void populateScrollPane() {
scrollPane.getComponents().clear();
int spacing = 15;
int height = 250;
int defaultX = spacing;
int y = spacing;
int x = spacing;
int width = 190;
int maxWidth = scrollPane.getWidth() - spacing * 2;
for(Cape cape : Athena.INSTANCE.getCosmeticsController().getCapeManager().getCapes()) {
CapeButton capeButton = new CapeButton(cape, x, y, width, height) {
@Override
public void onAction() {
setActive(false);
Athena.INSTANCE.getCosmeticsController().getCapeManager().setSelectedCape(cape);
populateScrollPane();
}
};
capeButton.setSelected(cape == Athena.INSTANCE.getCosmeticsController().getCapeManager().getSelectedCape());
scrollPane.addComponent(capeButton);
x += spacing + width;
if(x + spacing + width > maxWidth) {
x = defaultX;
y += height + spacing;
}
}
}
@Override
public void onRender() {
int width = 300;
int x = menu.getX() + menu.getWidth() - width + 20;
int y = menu.getY() + 59;
int height = 32;
drawVerticalLine(menu.getX() + 215, y + height - 30, height + 432, 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getSecondColor());
}
@Override
public void onLoad() {
menu.addComponent(scrollPane);
}
@Override
public void onUnload() {
}
@Override
public void onOpen() {
}
@Override
public void onClose() {
}
}

View File

@ -1,21 +1,17 @@
package rip.athena.client.gui.clickgui.pages; package rip.athena.client.gui.clickgui.pages;
import net.minecraft.client.renderer.GlStateManager;
import rip.athena.client.font.FontManager;
import rip.athena.client.gui.framework.Menu;
import rip.athena.client.gui.framework.MenuComponent;
import rip.athena.client.gui.clickgui.IngameMenu;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
import rip.athena.client.Athena;
import rip.athena.client.cosmetics.cape.Cape;
import rip.athena.client.gui.clickgui.IngameMenu;
import rip.athena.client.gui.clickgui.Page; import rip.athena.client.gui.clickgui.Page;
import rip.athena.client.gui.clickgui.components.cosmetics.*; import rip.athena.client.gui.clickgui.components.capes.CapeButton;
import rip.athena.client.gui.clickgui.components.macros.MacroButton; import rip.athena.client.gui.clickgui.components.cosmetics.CosmeticGenericButton;
import rip.athena.client.gui.clickgui.components.mods.MenuModKeybind; import rip.athena.client.gui.clickgui.components.cosmetics.CosmeticTextComponent;
import rip.athena.client.gui.clickgui.components.mods.ModCategoryButton;
import rip.athena.client.gui.clickgui.components.mods.ModScrollPane; import rip.athena.client.gui.clickgui.components.mods.ModScrollPane;
import rip.athena.client.gui.clickgui.pages.cosmetics.BandanaSize;
import rip.athena.client.gui.clickgui.pages.cosmetics.CapeType;
import rip.athena.client.gui.clickgui.pages.cosmetics.CosmeticType; import rip.athena.client.gui.clickgui.pages.cosmetics.CosmeticType;
import rip.athena.client.gui.framework.Menu;
/** /**
* @author Athena Development * @author Athena Development
@ -24,494 +20,169 @@ import rip.athena.client.gui.clickgui.pages.cosmetics.CosmeticType;
*/ */
public class CosmeticsPage extends Page { public class CosmeticsPage extends Page {
private CosmeticType cosmeticType = CosmeticType.CAPES; private ModScrollPane cosmeticsPane;
private ModScrollPane mainPane;
private CosmeticGenericButton capes;
private CosmeticGenericButton bandanas; private CosmeticGenericButton capes;
private CosmeticGenericButton emotes; private CosmeticGenericButton bandanas;
private CosmeticGenericButton flags; private CosmeticGenericButton emotes;
private CosmeticGenericButton flags;
private MenuModKeybind emoteWheelBind;
private CosmeticType cosmeticType;
private CosmeticBindButton bindButton1;
private CosmeticBindButton bindButton2; public CosmeticsPage(Minecraft mc, Menu menu, IngameMenu parent) {
private CosmeticBindButton bindButton3; super(mc, menu, parent);
private CosmeticBindButton bindButton4; }
private CosmeticBindButton lastButton; @Override
public void onInit() {
private CosmeticList capeLocation; int width = 300;
private CosmeticList bandanaLocation;
mainPane = new ModScrollPane(260, 150, menu.getWidth() - width, menu.getHeight() - 200, false);
private MacroButton resetButton; cosmeticsPane = new ModScrollPane(260, 150, menu.getWidth() - width, menu.getHeight() - 200, false);
int x = 270;
private CosmeticRainbowButton openCrateButton; int y = 90;
int typeWidth = 145;
private CosmeticGenericButton resetCape; int typeHeight = 30;
private CosmeticToggleButton capeEnabled;
cosmeticType = CosmeticType.CAPES;
private CosmeticUserPreview userPreview;
capes = new CosmeticGenericButton(CosmeticType.CAPES.toString(), x, y, typeWidth, typeHeight, false) {
private ModScrollPane scrollpane; @Override
public void onAction() {
public CosmeticsPage(Minecraft mc, Menu menu, IngameMenu parent) { setActive(false);
super(mc, menu, parent); cosmeticType = CosmeticType.CAPES;
} popularMainPane();
}
@Override };
public void onInit() {
int x = 15; bandanas = new CosmeticGenericButton(CosmeticType.BANDANAS.toString(), x + typeWidth + 20, y, typeWidth, typeHeight, false) {
int y = 59 + 50; @Override
int typeWidth = 125; public void onAction() {
int typeHeight = 20; setActive(false);
cosmeticType = CosmeticType.BANDANAS;
int width = 300; popularMainPane();
int compWidth = width - 6 - 20 * 2; }
};
capes = new CosmeticGenericButton(CosmeticType.CAPES.toString(), x, y, typeWidth, typeHeight, false) {
@Override emotes = new CosmeticGenericButton(CosmeticType.EMOTES.toString(), x + typeWidth + 185, y, typeWidth, typeHeight, false) {
public void onAction() { @Override
setActive(false); public void onAction() {
cosmeticType = CosmeticType.CAPES; setActive(false);
populateScrollPane(); cosmeticType = CosmeticType.EMOTES;
} popularMainPane();
}; }
};
bandanas = new CosmeticGenericButton(CosmeticType.BANDANAS.toString(), x + typeWidth + 20, y, typeWidth, typeHeight, false) {
@Override flags = new CosmeticGenericButton(CosmeticType.FLAGS.toString(), x + typeWidth + 350, y, typeWidth, typeHeight, false) {
public void onAction() { @Override
setActive(false); public void onAction() {
cosmeticType = CosmeticType.BANDANAS; setActive(false);
populateScrollPane(); cosmeticType = CosmeticType.FLAGS;
} popularMainPane();
}; }
};
emotes = new CosmeticGenericButton(CosmeticType.EMOTES.toString(), x, y + typeHeight + 10, typeWidth, typeHeight, false) {
@Override popularMainPane();
public void onAction() {
setActive(false); }
cosmeticType = CosmeticType.EMOTES;
populateScrollPane(); private void popularMainPane() {
} mainPane.getComponents().clear();
}; cosmeticsPane.getComponents().clear();
flags = new CosmeticGenericButton(CosmeticType.FLAGS.toString(), x + typeWidth + 20, y + typeHeight + 10, typeWidth, typeHeight, false) { if(cosmeticType == CosmeticType.CAPES) {
@Override populateCosmeticsScrollPane();
public void onAction() { } else if(cosmeticType == CosmeticType.EMOTES) {
setActive(false); populateUnusedPane();
cosmeticType = CosmeticType.FLAGS; } else if(cosmeticType == CosmeticType.BANDANAS) {
populateScrollPane(); populateUnusedPane();
} } else if(cosmeticType == CosmeticType.FLAGS) {
}; populateUnusedPane();
} else if(cosmeticType == CosmeticType.NONE) {
populateUnusedPane();
scrollpane = new ModScrollPane(x, y + typeHeight * 2 + 20, width - x - 2, menu.getHeight() - y - typeHeight * 2 - 20 - 1, true); }
}
x = menu.getWidth() - width + 20;
y -= 30; private void populateUnusedPane() {
mainPane.getComponents().clear();
emoteWheelBind = new MenuModKeybind(x - 21 + width / 2 - compWidth / 2, y + 50, compWidth, 22) { cosmeticsPane.getComponents().clear();
@Override
public void onAction() { mainPane.addComponent(new CosmeticTextComponent(mainPane.getX() , mainPane.getY() , 0, 0, -1));
//Athena.INSTANCE.emoteSettings.setKeyBind(getBind()); }
//Athena.INSTANCE.emoteSettings.saveEmoteSettings();
} private void populateCosmeticsScrollPane() {
}; cosmeticsPane.getComponents().clear();
bindButton1 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 110, compWidth, 22) { int spacing = 15;
@Override int height = 250;
public void onAction() {
lastButton = this; int defaultX = spacing;
unpressAll(lastButton);
} int y = spacing;
}; int x = spacing;
bindButton2 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 140, compWidth, 22) { int width = 190;
@Override
public void onAction() { int maxWidth = cosmeticsPane.getWidth() - spacing * 2;
lastButton = this;
unpressAll(lastButton); for(Cape cape : Athena.INSTANCE.getCosmeticsController().getCapeManager().getCapes()) {
} CapeButton capeButton = new CapeButton(cape, x, y, width, height) {
}; @Override
public void onAction() {
bindButton3 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 170, compWidth, 22) { setActive(false);
@Override Athena.INSTANCE.getCosmeticsController().getCapeManager().setSelectedCape(cape);
public void onAction() { populateCosmeticsScrollPane();
lastButton = this; }
unpressAll(lastButton); };
}
}; capeButton.setSelected(cape == Athena.INSTANCE.getCosmeticsController().getCapeManager().getSelectedCape());
bindButton4 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 200, compWidth, 22) { cosmeticsPane.addComponent(capeButton);
@Override
public void onAction() { x += spacing + width;
lastButton = this;
unpressAll(lastButton); if(x + spacing + width > maxWidth) {
} x = defaultX;
}; y += height + spacing;
}
capeLocation = new CosmeticList(CapeType.class, x - 21 + width / 2 - compWidth / 2, y + 260, compWidth, 22) { }
@Override }
public void onAction() {
/*if(Athena.INSTANCE.capeManager != null) {
Athena.INSTANCE.capeManager.getSettings().setType(CapeType.valueOf(getValue().replace(' ', '_').toUpperCase())); @Override
Athena.INSTANCE.capeManager.saveSettings(); public void onRender() {
}*/ int width = 300;
} int x = menu.getX() + menu.getWidth() - width + 20;
}; int y = menu.getY() + 59;
int height = 32;
bandanaLocation = new CosmeticList(BandanaSize.class, x - 21 + width / 2 - compWidth / 2, y + 320, compWidth, 22) {
@Override drawVerticalLine(menu.getX() + 215, y + height - 30, height + 432, 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getSecondColor());
public void onAction() { }
/*BandanaPlayerHandler handler = Athena.INSTANCE.bandanaManager.getFromUUID(mc.thePlayer.getUniqueID().toString());
@Override
int bandanaHeightOffset = 0; public void onLoad() {
BandanaSize val = BandanaSize.valueOf(getValue().toUpperCase()); menu.addComponent(mainPane);
menu.addComponent(cosmeticsPane);
switch(val) {
case LARGE:
bandanaHeightOffset = 8;
break;
case MEDIUM:
bandanaHeightOffset = 7;
break;
case SMALL:
bandanaHeightOffset = 5;
break;
default:
break;
}
if(handler != null) {
handler.updateBandanaHeight(bandanaHeightOffset);
}*/
}
};
resetButton = new MacroButton("RESET TO DEFAULT", x - 21 + width / 2 - compWidth / 2, menu.getHeight() - 22 - 20, compWidth, 22, false) {
@Override
public void onAction() {
setActive(false);
emoteWheelBind.setBind(Keyboard.CHAR_NONE);
bindButton1.setBind("");
bindButton2.setBind("");
bindButton3.setBind("");
bindButton4.setBind("");
/*Athena.INSTANCE.emoteSettings.setKeyBind(Keyboard.CHAR_NONE);
Athena.INSTANCE.emoteSettings.setEmote1("");
Athena.INSTANCE.emoteSettings.setEmote2("");
Athena.INSTANCE.emoteSettings.setEmote3("");
Athena.INSTANCE.emoteSettings.setEmote4("");
Athena.INSTANCE.emoteSettings.saveEmoteSettings();
capeLocation.setValue(CapeType.NORMAL.toString());*/
bandanaLocation.setValue(BandanaSize.MEDIUM.toString());
}
};
x = menu.getWidth() / 2;
width = 350;
openCrateButton = new CosmeticRainbowButton("OPEN A CRATE", x - width / 2, y, width, 40) {
@Override
public void onAction() {
setActive(false);
Minecraft.getMinecraft().displayGuiScreen(null);
/*if(Athena.INSTANCE.crateManager.hasCrate(mc.thePlayer)) {
Athena.INSTANCE.notificationManager.showNotification("Please wait for your last crate to finish first.", Color.RED);
return;
}
NetworkingClient.sendLine("Opencrate", "emote");*/
}
};
resetCape = new CosmeticGenericButton("SET CAPE TO NONE", x - width / 2, menu.getHeight() - 40 - 40, width, 20, true) {
@Override
public void onAction() {
setActive(false);
/*if(Athena.INSTANCE.capeManager != null) {
new Thread(() -> {
Athena.INSTANCE.capeManager.getCape("none").updateSelectedCape();
Athena.INSTANCE.capeManager.capeLookupThread.performUpdate();
}).start();
}*/
}
};
/*capeEnabled = new CosmeticToggleButton(Athena.INSTANCE.capeManager != null && Athena.INSTANCE.capeManager.getSettings().getEnabled() ? "ENABLED" : "DISABLED", x - width / 2, menu.getHeight() - 40 - 15, width, 20, Athena.INSTANCE.capeManager != null && Athena.INSTANCE.capeManager.getSettings().getEnabled()) {
@Override
public void onAction() {
setActive(false);
if(Athena.INSTANCE.capeManager != null) {
Athena.INSTANCE.capeManager.getSettings().setEnabled(!Athena.INSTANCE.capeManager.getSettings().getEnabled());
Athena.INSTANCE.capeManager.saveSettings();
capeEnabled.setText(Athena.INSTANCE.capeManager.getSettings().getEnabled() ? "ENABLED" : "DISABLED");
capeEnabled.setApprove(Athena.INSTANCE.capeManager.getSettings().getEnabled());
}
}
};*/
userPreview = new CosmeticUserPreview(x - width / 2, y + 45, width, 275);
/*if(Athena.INSTANCE.capeManager != null) {
capeLocation.setValue(Athena.INSTANCE.capeManager.getSettings().getType().toString());
}*/
bandanaLocation.setValue(BandanaSize.MEDIUM.toString());
populateScrollPane();
}
private void updateMenuStates(boolean load) {
for(MenuComponent comp : menu.getComponents()) {
if(comp instanceof CosmeticGenericButton) {
CosmeticGenericButton button = (CosmeticGenericButton) comp;
if(!button.getText().equalsIgnoreCase(cosmeticType.toString())) {
button.setActive(false);
} else {
button.setActive(true);
if(load) {
button.onAction();
}
}
}
}
}
private void populateScrollPane() {
scrollpane.getComponents().clear();
updateMenuStates(false);
/*if(cosmeticType == CosmeticType.CAPES) {
int spacing = 10;
int originalX = 10;
int x = originalX;
int y = 10;
int width = 120;
int height = 170;
if(Athena.INSTANCE.capeManager != null) {
for(Cape cape : Athena.INSTANCE.capeManager.ownedCapes) {
CosmeticCapeView view = new CosmeticCapeView(cape, x, y, width, height);
scrollpane.addComponent(view);
scrollpane.addComponent(new CosmeticGenericButton("ENABLE", x + 5, y + view.getHeight() - 25, width - 10, 20, true) {
@Override
public void onAction() {
setActive(false);
mc.thePlayer.capeOverride = cape.getPreview();
new Thread(() -> {
cape.updateSelectedCape();
}).start();
}
});
x += view.getWidth() + spacing;
if(x + view.getWidth() + spacing > scrollpane.getWidth()) {
x = originalX;
y += view.getHeight() + spacing;
}
}
}
} else if(cosmeticType == CosmeticType.EMOTES) {
int spacing = 10;
int originalX = 0;
int x = originalX;
int y = 10;
int width = scrollpane.getWidth() - 15;
int height = 30;
if(Athena.INSTANCE.emoteManager != null) {
for(Emote emote : Athena.INSTANCE.emoteManager.ownedEmotes) {
scrollpane.addComponent(new CosmeticActionButton(I18n.format(emote.getTitle().toUpperCase()), emote.getKey(), x, y + height - 25, width - 10, height, true) {
@Override
public void onAction() {
setActive(false);
pressEmote(I18n.format(emote.getTitle()));
}
});
y += height + spacing;
}
}
} else if(cosmeticType == CosmeticType.BANDANAS) {
int spacing = 10;
int originalX = 0;
int x = originalX;
int y = 10;
int width = scrollpane.getWidth() - 15;
int height = 30;
if(Athena.INSTANCE.bandanaManager != null) {
for(Bandana bandana : Athena.INSTANCE.bandanaManager.ownedBandanas) {
scrollpane.addComponent(new CosmeticActionButton(bandana.getName().toUpperCase(), bandana.getName(), x, y + height - 25, width - 10, height, true) {
@Override
public void onAction() {
setActive(false);
new Thread(() -> {
bandana.updateSelectedBandana(bandanaLocation.getValue());
}).start();
}
});
y += height + spacing;
}
}
} else if(cosmeticType == CosmeticType.FLAGS) {
}*/ menu.addComponent(capes);
} menu.addComponent(bandanas);
menu.addComponent(emotes);
menu.addComponent(flags);
}
@Override @Override
public void onRender() { public void onUnload() {
int width = 300;
int x = menu.getX() + menu.getWidth() - width + 20;
int y = menu.getY() + 59;
int height = 32;
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX() + menu.getWidth() - width, menu.getY() + 58, width, menu.getHeight() - 58, MacrosPage.MENU_SIDE_BG_COLOR); }
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX() + menu.getWidth() - width, menu.getY() + 58, width, height + 1, ModCategoryButton.MAIN_COLOR); @Override
drawShadowDown(menu.getX() + menu.getWidth() - width, y + height, width); public void onOpen() {
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("COSMETIC SETTINGS", menu.getX() + menu.getWidth() - width / 2 - rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width("COSMETIC SETTINGS") / 2, y + height / 2 - FontManager.baloo17.getHeight("COSMETIC SETTINGS") / 2, IngameMenu.MENU_HEADER_TEXT_COLOR);
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX(), menu.getY() + 58, width, menu.getHeight() - 58, MacrosPage.MENU_SIDE_BG_COLOR); }
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX(), menu.getY() + 58, width, height + 1, ModCategoryButton.MAIN_COLOR); @Override
drawShadowDown(menu.getX(), y + height, width); public void onClose() {
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("COSMETICS", menu.getX() + width / 2 - rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width("COSMETICS") / 2, y + height / 2 - FontManager.baloo17.getHeight("COSMETICS") / 2, IngameMenu.MENU_HEADER_TEXT_COLOR);
drawShadowDown(menu.getX(), y - 1, width); }
drawShadowDown(menu.getX() + menu.getWidth() - width, y - 1, width);
x += 3;
y += 50;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("EMOTE WHEEL KEYBIND", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
y += 60;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("ENABLED EMOTES", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
y += 150;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("CAPE LOCATION", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
y += 60;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("BANDANA LOCATION", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
}
@Override
public void onLoad() {
/*if(Athena.INSTANCE.capeManager != null) {
Athena.INSTANCE.capeManager.updateOwnedCapes();
}
if(Athena.INSTANCE.bandanaManager != null) {
Athena.INSTANCE.bandanaManager.updateOwnedBandanas();
}
if(Athena.INSTANCE.emoteManager != null) {
Athena.INSTANCE.emoteManager.updateOwnedEmotes();
}*/
menu.addComponent(capes);
menu.addComponent(bandanas);
menu.addComponent(emotes);
menu.addComponent(flags);
menu.addComponent(emoteWheelBind);
menu.addComponent(bindButton1);
menu.addComponent(bindButton2);
menu.addComponent(bindButton3);
menu.addComponent(bindButton4);
menu.addComponent(capeLocation);
menu.addComponent(bandanaLocation);
menu.addComponent(resetButton);
menu.addComponent(openCrateButton);
menu.addComponent(resetCape);
//menu.addComponent(capeEnabled);
menu.addComponent(userPreview);
menu.addComponent(scrollpane);
updateMenuStates(false);
}
@Override
public void onUnload() {
}
@Override
public void onOpen() {
}
@Override
public void onClose() {
}
private void pressEmote(String emote) {
if(lastButton != null) {
lastButton.setBind(emote);
/*if(lastButton == bindButton1) {
Athena.INSTANCE.emoteSettings.setEmote1(emote);
} else if(lastButton == bindButton2) {
Athena.INSTANCE.emoteSettings.setEmote2(emote);
} else if(lastButton == bindButton3) {
Athena.INSTANCE.emoteSettings.setEmote3(emote);
} else if(lastButton == bindButton4) {
Athena.INSTANCE.emoteSettings.setEmote4(emote);
}
Athena.INSTANCE.emoteSettings.saveEmoteSettings();*/
lastButton = null;
unpressAll(lastButton);
}
}
private void unpressAll(CosmeticBindButton b) {
for(MenuComponent comp : menu.getComponents()) {
if(comp instanceof CosmeticBindButton) {
CosmeticBindButton button = (CosmeticBindButton) comp;
if(button != b) {
button.setActive(false);
}
}
}
}
} }

View File

@ -0,0 +1,516 @@
package rip.athena.client.gui.clickgui.pages;
import rip.athena.client.font.FontManager;
import rip.athena.client.gui.framework.Menu;
import rip.athena.client.gui.framework.MenuComponent;
import rip.athena.client.gui.clickgui.IngameMenu;
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
import rip.athena.client.gui.clickgui.Page;
import rip.athena.client.gui.clickgui.components.cosmetics.*;
import rip.athena.client.gui.clickgui.components.macros.MacroButton;
import rip.athena.client.gui.clickgui.components.mods.MenuModKeybind;
import rip.athena.client.gui.clickgui.components.mods.ModCategoryButton;
import rip.athena.client.gui.clickgui.components.mods.ModScrollPane;
import rip.athena.client.gui.clickgui.pages.cosmetics.BandanaSize;
import rip.athena.client.gui.clickgui.pages.cosmetics.CapeType;
import rip.athena.client.gui.clickgui.pages.cosmetics.CosmeticType;
/**
* @author Athena Development
* @project Athena-Client
* @date 6/2/2023
*/
public class OldCosmeticsPage extends Page {
private CosmeticType cosmeticType = CosmeticType.CAPES;
private CosmeticGenericButton capes;
private CosmeticGenericButton bandanas;
private CosmeticGenericButton emotes;
private CosmeticGenericButton flags;
private MenuModKeybind emoteWheelBind;
private CosmeticBindButton bindButton1;
private CosmeticBindButton bindButton2;
private CosmeticBindButton bindButton3;
private CosmeticBindButton bindButton4;
private CosmeticBindButton lastButton;
private CosmeticList capeLocation;
private CosmeticList bandanaLocation;
private MacroButton resetButton;
private CosmeticRainbowButton openCrateButton;
private CosmeticGenericButton resetCape;
private CosmeticToggleButton capeEnabled;
private CosmeticUserPreview userPreview;
private ModScrollPane scrollpane;
public OldCosmeticsPage(Minecraft mc, Menu menu, IngameMenu parent) {
super(mc, menu, parent);
}
@Override
public void onInit() {
int x = 15;
int y = 59 + 50;
int typeWidth = 125;
int typeHeight = 20;
int width = 300;
int compWidth = width - 6 - 20 * 2;
capes = new CosmeticGenericButton(CosmeticType.CAPES.toString(), x, y, typeWidth, typeHeight, false) {
@Override
public void onAction() {
setActive(false);
cosmeticType = CosmeticType.CAPES;
populateScrollPane();
}
};
bandanas = new CosmeticGenericButton(CosmeticType.BANDANAS.toString(), x + typeWidth + 20, y, typeWidth, typeHeight, false) {
@Override
public void onAction() {
setActive(false);
cosmeticType = CosmeticType.BANDANAS;
populateScrollPane();
}
};
emotes = new CosmeticGenericButton(CosmeticType.EMOTES.toString(), x, y + typeHeight + 10, typeWidth, typeHeight, false) {
@Override
public void onAction() {
setActive(false);
cosmeticType = CosmeticType.EMOTES;
populateScrollPane();
}
};
flags = new CosmeticGenericButton(CosmeticType.FLAGS.toString(), x + typeWidth + 20, y + typeHeight + 10, typeWidth, typeHeight, false) {
@Override
public void onAction() {
setActive(false);
cosmeticType = CosmeticType.FLAGS;
populateScrollPane();
}
};
scrollpane = new ModScrollPane(x, y + typeHeight * 2 + 20, width - x - 2, menu.getHeight() - y - typeHeight * 2 - 20 - 1, true);
x = menu.getWidth() - width + 20;
y -= 30;
emoteWheelBind = new MenuModKeybind(x - 21 + width / 2 - compWidth / 2, y + 50, compWidth, 22) {
@Override
public void onAction() {
//Athena.INSTANCE.emoteSettings.setKeyBind(getBind());
//Athena.INSTANCE.emoteSettings.saveEmoteSettings();
}
};
bindButton1 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 110, compWidth, 22) {
@Override
public void onAction() {
lastButton = this;
unpressAll(lastButton);
}
};
bindButton2 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 140, compWidth, 22) {
@Override
public void onAction() {
lastButton = this;
unpressAll(lastButton);
}
};
bindButton3 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 170, compWidth, 22) {
@Override
public void onAction() {
lastButton = this;
unpressAll(lastButton);
}
};
bindButton4 = new CosmeticBindButton(x - 21 + width / 2 - compWidth / 2, y + 200, compWidth, 22) {
@Override
public void onAction() {
lastButton = this;
unpressAll(lastButton);
}
};
capeLocation = new CosmeticList(CapeType.class, x - 21 + width / 2 - compWidth / 2, y + 260, compWidth, 22) {
@Override
public void onAction() {
/*if(Athena.INSTANCE.capeManager != null) {
Athena.INSTANCE.capeManager.getSettings().setType(CapeType.valueOf(getValue().replace(' ', '_').toUpperCase()));
Athena.INSTANCE.capeManager.saveSettings();
}*/
}
};
bandanaLocation = new CosmeticList(BandanaSize.class, x - 21 + width / 2 - compWidth / 2, y + 320, compWidth, 22) {
@Override
public void onAction() {
/*BandanaPlayerHandler handler = Athena.INSTANCE.bandanaManager.getFromUUID(mc.thePlayer.getUniqueID().toString());
int bandanaHeightOffset = 0;
BandanaSize val = BandanaSize.valueOf(getValue().toUpperCase());
switch(val) {
case LARGE:
bandanaHeightOffset = 8;
break;
case MEDIUM:
bandanaHeightOffset = 7;
break;
case SMALL:
bandanaHeightOffset = 5;
break;
default:
break;
}
if(handler != null) {
handler.updateBandanaHeight(bandanaHeightOffset);
}*/
}
};
resetButton = new MacroButton("RESET TO DEFAULT", x - 21 + width / 2 - compWidth / 2, menu.getHeight() - 22 - 20, compWidth, 22, false) {
@Override
public void onAction() {
setActive(false);
emoteWheelBind.setBind(Keyboard.CHAR_NONE);
bindButton1.setBind("");
bindButton2.setBind("");
bindButton3.setBind("");
bindButton4.setBind("");
/*Athena.INSTANCE.emoteSettings.setKeyBind(Keyboard.CHAR_NONE);
Athena.INSTANCE.emoteSettings.setEmote1("");
Athena.INSTANCE.emoteSettings.setEmote2("");
Athena.INSTANCE.emoteSettings.setEmote3("");
Athena.INSTANCE.emoteSettings.setEmote4("");
Athena.INSTANCE.emoteSettings.saveEmoteSettings();
capeLocation.setValue(CapeType.NORMAL.toString());*/
bandanaLocation.setValue(BandanaSize.MEDIUM.toString());
}
};
x = menu.getWidth() / 2;
width = 350;
openCrateButton = new CosmeticRainbowButton("OPEN A CRATE", x - width / 2, y, width, 40) {
@Override
public void onAction() {
setActive(false);
Minecraft.getMinecraft().displayGuiScreen(null);
/*if(Athena.INSTANCE.crateManager.hasCrate(mc.thePlayer)) {
Athena.INSTANCE.notificationManager.showNotification("Please wait for your last crate to finish first.", Color.RED);
return;
}
NetworkingClient.sendLine("Opencrate", "emote");*/
}
};
resetCape = new CosmeticGenericButton("SET CAPE TO NONE", x - width / 2, menu.getHeight() - 40 - 40, width, 20, true) {
@Override
public void onAction() {
setActive(false);
/*if(Athena.INSTANCE.capeManager != null) {
new Thread(() -> {
Athena.INSTANCE.capeManager.getCape("none").updateSelectedCape();
Athena.INSTANCE.capeManager.capeLookupThread.performUpdate();
}).start();
}*/
}
};
/*capeEnabled = new CosmeticToggleButton(Athena.INSTANCE.capeManager != null && Athena.INSTANCE.capeManager.getSettings().getEnabled() ? "ENABLED" : "DISABLED", x - width / 2, menu.getHeight() - 40 - 15, width, 20, Athena.INSTANCE.capeManager != null && Athena.INSTANCE.capeManager.getSettings().getEnabled()) {
@Override
public void onAction() {
setActive(false);
if(Athena.INSTANCE.capeManager != null) {
Athena.INSTANCE.capeManager.getSettings().setEnabled(!Athena.INSTANCE.capeManager.getSettings().getEnabled());
Athena.INSTANCE.capeManager.saveSettings();
capeEnabled.setText(Athena.INSTANCE.capeManager.getSettings().getEnabled() ? "ENABLED" : "DISABLED");
capeEnabled.setApprove(Athena.INSTANCE.capeManager.getSettings().getEnabled());
}
}
};*/
userPreview = new CosmeticUserPreview(x - width / 2, y + 45, width, 275);
/*if(Athena.INSTANCE.capeManager != null) {
capeLocation.setValue(Athena.INSTANCE.capeManager.getSettings().getType().toString());
}*/
bandanaLocation.setValue(BandanaSize.MEDIUM.toString());
populateScrollPane();
}
private void updateMenuStates(boolean load) {
for(MenuComponent comp : menu.getComponents()) {
if(comp instanceof CosmeticGenericButton) {
CosmeticGenericButton button = (CosmeticGenericButton) comp;
if(!button.getText().equalsIgnoreCase(cosmeticType.toString())) {
button.setActive(false);
} else {
button.setActive(true);
if(load) {
button.onAction();
}
}
}
}
}
private void populateScrollPane() {
scrollpane.getComponents().clear();
updateMenuStates(false);
/*if(cosmeticType == CosmeticType.CAPES) {
int spacing = 10;
int originalX = 10;
int x = originalX;
int y = 10;
int width = 120;
int height = 170;
if(Athena.INSTANCE.capeManager != null) {
for(Cape cape : Athena.INSTANCE.capeManager.ownedCapes) {
CosmeticCapeView view = new CosmeticCapeView(cape, x, y, width, height);
scrollpane.addComponent(view);
scrollpane.addComponent(new CosmeticGenericButton("ENABLE", x + 5, y + view.getHeight() - 25, width - 10, 20, true) {
@Override
public void onAction() {
setActive(false);
mc.thePlayer.capeOverride = cape.getPreview();
new Thread(() -> {
cape.updateSelectedCape();
}).start();
}
});
x += view.getWidth() + spacing;
if(x + view.getWidth() + spacing > scrollpane.getWidth()) {
x = originalX;
y += view.getHeight() + spacing;
}
}
}
} else if(cosmeticType == CosmeticType.EMOTES) {
int spacing = 10;
int originalX = 0;
int x = originalX;
int y = 10;
int width = scrollpane.getWidth() - 15;
int height = 30;
if(Athena.INSTANCE.emoteManager != null) {
for(Emote emote : Athena.INSTANCE.emoteManager.ownedEmotes) {
scrollpane.addComponent(new CosmeticActionButton(I18n.format(emote.getTitle().toUpperCase()), emote.getKey(), x, y + height - 25, width - 10, height, true) {
@Override
public void onAction() {
setActive(false);
pressEmote(I18n.format(emote.getTitle()));
}
});
y += height + spacing;
}
}
} else if(cosmeticType == CosmeticType.BANDANAS) {
int spacing = 10;
int originalX = 0;
int x = originalX;
int y = 10;
int width = scrollpane.getWidth() - 15;
int height = 30;
if(Athena.INSTANCE.bandanaManager != null) {
for(Bandana bandana : Athena.INSTANCE.bandanaManager.ownedBandanas) {
scrollpane.addComponent(new CosmeticActionButton(bandana.getName().toUpperCase(), bandana.getName(), x, y + height - 25, width - 10, height, true) {
@Override
public void onAction() {
setActive(false);
new Thread(() -> {
bandana.updateSelectedBandana(bandanaLocation.getValue());
}).start();
}
});
y += height + spacing;
}
}
} else if(cosmeticType == CosmeticType.FLAGS) {
}*/
}
@Override
public void onRender() {
int width = 300;
int x = menu.getX() + menu.getWidth() - width + 20;
int y = menu.getY() + 59;
int height = 32;
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX() + menu.getWidth() - width, menu.getY() + 58, width, menu.getHeight() - 58, MacrosPage.MENU_SIDE_BG_COLOR);
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX() + menu.getWidth() - width, menu.getY() + 58, width, height + 1, ModCategoryButton.MAIN_COLOR);
drawShadowDown(menu.getX() + menu.getWidth() - width, y + height, width);
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("COSMETIC SETTINGS", menu.getX() + menu.getWidth() - width / 2 - rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width("COSMETIC SETTINGS") / 2, y + height / 2 - FontManager.baloo17.getHeight("COSMETIC SETTINGS") / 2, IngameMenu.MENU_HEADER_TEXT_COLOR);
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX(), menu.getY() + 58, width, menu.getHeight() - 58, MacrosPage.MENU_SIDE_BG_COLOR);
rip.athena.client.gui.framework.draw.DrawImpl.drawRect(menu.getX(), menu.getY() + 58, width, height + 1, ModCategoryButton.MAIN_COLOR);
drawShadowDown(menu.getX(), y + height, width);
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("COSMETICS", menu.getX() + width / 2 - rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width("COSMETICS") / 2, y + height / 2 - FontManager.baloo17.getHeight("COSMETICS") / 2, IngameMenu.MENU_HEADER_TEXT_COLOR);
drawShadowDown(menu.getX(), y - 1, width);
drawShadowDown(menu.getX() + menu.getWidth() - width, y - 1, width);
x += 3;
y += 50;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("EMOTE WHEEL KEYBIND", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
y += 60;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("ENABLED EMOTES", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
y += 150;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("CAPE LOCATION", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
y += 60;
rip.athena.client.utils.font.FontManager.getProductSansRegular(30).drawString("BANDANA LOCATION", x, y, IngameMenu.MENU_HEADER_TEXT_COLOR);
}
@Override
public void onLoad() {
/*if(Athena.INSTANCE.capeManager != null) {
Athena.INSTANCE.capeManager.updateOwnedCapes();
}
if(Athena.INSTANCE.bandanaManager != null) {
Athena.INSTANCE.bandanaManager.updateOwnedBandanas();
}
if(Athena.INSTANCE.emoteManager != null) {
Athena.INSTANCE.emoteManager.updateOwnedEmotes();
}*/
menu.addComponent(capes);
menu.addComponent(bandanas);
menu.addComponent(emotes);
menu.addComponent(flags);
menu.addComponent(emoteWheelBind);
menu.addComponent(bindButton1);
menu.addComponent(bindButton2);
menu.addComponent(bindButton3);
menu.addComponent(bindButton4);
menu.addComponent(capeLocation);
menu.addComponent(bandanaLocation);
menu.addComponent(resetButton);
menu.addComponent(openCrateButton);
menu.addComponent(resetCape);
//menu.addComponent(capeEnabled);
menu.addComponent(userPreview);
menu.addComponent(scrollpane);
updateMenuStates(false);
}
@Override
public void onUnload() {
}
@Override
public void onOpen() {
}
@Override
public void onClose() {
}
private void pressEmote(String emote) {
if(lastButton != null) {
lastButton.setBind(emote);
/*if(lastButton == bindButton1) {
Athena.INSTANCE.emoteSettings.setEmote1(emote);
} else if(lastButton == bindButton2) {
Athena.INSTANCE.emoteSettings.setEmote2(emote);
} else if(lastButton == bindButton3) {
Athena.INSTANCE.emoteSettings.setEmote3(emote);
} else if(lastButton == bindButton4) {
Athena.INSTANCE.emoteSettings.setEmote4(emote);
}
Athena.INSTANCE.emoteSettings.saveEmoteSettings();*/
lastButton = null;
unpressAll(lastButton);
}
}
private void unpressAll(CosmeticBindButton b) {
for(MenuComponent comp : menu.getComponents()) {
if(comp instanceof CosmeticBindButton) {
CosmeticBindButton button = (CosmeticBindButton) comp;
if(button != b) {
button.setActive(false);
}
}
}
}
}

View File

@ -7,7 +7,7 @@ package rip.athena.client.gui.clickgui.pages.cosmetics;
*/ */
public enum CosmeticType { public enum CosmeticType {
CAPES("CAPES"), BANDANAS("BANDANAS"), EMOTES("EMOTES"), FLAGS("FLAGS"); CAPES("CAPES"), BANDANAS("BANDANAS"), EMOTES("EMOTES"), FLAGS("FLAGS"), NONE("NONE");
String type; String type;