Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Join hypickle button in custommainmenu #244

Merged
merged 4 commits into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiOptions;
import net.minecraft.client.gui.GuiSelectWorld;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.GuiModList;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

Expand Down Expand Up @@ -66,6 +68,7 @@ public void populateMap() {

private UIComponent singleplayerButton;
private UIComponent multiplayerButton;
private UIComponent joinHypixelButton;
private UIComponent modsButton;
private UIComponent optionsButton;
private UIComponent pssOptionsButton;
Expand All @@ -77,12 +80,14 @@ public void populateMap() {

private UIComponent singleplayerText;
private UIComponent multiplayerText;
private UIComponent joinHypixelText;
private UIComponent modsText;
private UIComponent optionsText;
private UIComponent pssOptionsText;
private UIComponent quitText;
private UIComponent timeText;
private UIComponent discordText;
private final String hypixelIP = "mc.hypixel.net"; // I want to use "ilovecatgirls.xyz" to bad

private static ArrayList<Announcement> announcements = new ArrayList<>();
public static String latestVersion = "(Unknown)";
Expand Down Expand Up @@ -213,7 +218,7 @@ public void populateGui(float scaleFactor) {

multiplayerButton = new UIBlock()
.setX(new CenterConstraint())
.setY(new PixelConstraint(260 * scaleFactor))
.setY(new PixelConstraint(240 * scaleFactor))
.setHeight(new PixelConstraint(40 * scaleFactor))
.setWidth(new PixelConstraint(middleMenu.getWidth()))
.setColor(new Color(0, 0, 0, 0))
Expand All @@ -231,6 +236,26 @@ public void populateGui(float scaleFactor) {

multiplayerButton.onMouseLeaveRunnable(() -> multiplayerText.setColor(new Color(255, 255, 255)));

joinHypixelButton = new UIBlock()
.setX(new CenterConstraint())
.setY(new PixelConstraint(280 * scaleFactor))
.setHeight(new PixelConstraint(40 * scaleFactor))
.setWidth(new PixelConstraint(middleMenu.getWidth()))
.setColor(new Color(0, 0, 0, 0))
.setChildOf(middleMenu);

joinHypixelText = new UIText("Join Hypixel")
.setX(new CenterConstraint())
.setY(new CenterConstraint())
.setTextScale(new PixelConstraint(1 * scaleFactor))
.setChildOf(joinHypixelButton);

joinHypixelButton.onMouseClickConsumer(event -> FMLClientHandler.instance().connectToServer(new GuiMultiplayer(PartlySaneSkies.minecraft.currentScreen), new ServerData("AddictionGame", hypixelIP, false)));

joinHypixelButton.onMouseEnterRunnable(() -> joinHypixelText.setColor(new Color(200, 200, 200)));

joinHypixelButton.onMouseLeaveRunnable(() -> joinHypixelText.setColor(new Color(255, 255, 255)));

modsButton = new UIBlock()
.setX(new CenterConstraint())
.setY(new PixelConstraint(320 * scaleFactor))
Expand Down Expand Up @@ -387,13 +412,21 @@ public void resizeGui(float scaleFactor) {
.setTextScale(new PixelConstraint(1 * scaleFactor));

multiplayerButton
.setY(new PixelConstraint(260 * scaleFactor))
.setY(new PixelConstraint(240 * scaleFactor))
.setHeight(new PixelConstraint(40 * scaleFactor))
.setWidth(new PixelConstraint(middleMenu.getWidth()));

multiplayerText
.setTextScale(new PixelConstraint(1 * scaleFactor));

joinHypixelButton
.setY(new PixelConstraint(280 * scaleFactor))
.setHeight(new PixelConstraint(40 * scaleFactor))
.setWidth(new PixelConstraint(middleMenu.getWidth()));

joinHypixelText
.setTextScale(new PixelConstraint(1 * scaleFactor));

modsButton
.setY(new PixelConstraint(320 * scaleFactor))
.setHeight(new PixelConstraint(40 * scaleFactor))
Expand Down