MCPcopy Create free account
hub / github.com/5zig/The-5zig-Mod / patchMainMenu

Method patchMainMenu

Minecraft-Utils/1.13/src/ClassProxy.java:101–153  ·  view source on GitHub ↗
(Object instance, int paramInt1, int paramInt2, boolean isForge)

Source from the content-addressed store, hash-verified

99 }
100
101 public static void patchMainMenu(Object instance, int paramInt1, int paramInt2, boolean isForge) {
102 cjx guiMainMenu = (cjx) instance;
103 if (!MinecraftFactory.getClassProxyCallback().isShowLastServer())
104 return;
105 String lastServer;
106 IButton button;
107 String server = MinecraftFactory.getClassProxyCallback().getLastServer();
108 int x = guiMainMenu.m / 2 + 2;
109 int y = paramInt1 + paramInt2;
110 if (server != null) {
111 String[] parts = server.split(":");
112 String host = parts[parts.length - 2];
113 int port = Integer.parseInt(parts[parts.length - 1]);
114 if (port == 25565) {
115 lastServer = host;
116 } else {
117 lastServer = host + ":" + port;
118 }
119 lastServer = MinecraftFactory.getVars().shortenToWidth(lastServer, 88);
120 button = new Button(99, x, y, 98, 20, lastServer) {
121 @Override
122 protected void onClick(double mouseX, double mouseY) {
123 String server = MinecraftFactory.getClassProxyCallback().getLastServer();
124 if (server == null)
125 return;
126 String[] parts = server.split(":");
127 String host = parts[parts.length - 2];
128 int port = Integer.parseInt(parts[parts.length - 1]);
129 MinecraftFactory.getVars().joinServer(host, port);
130 }
131 };
132 } else {
133 button = MinecraftFactory.getVars().createButton(98, x, y, 98, 20, MinecraftFactory.getClassProxyCallback().translate("menu.no_last_server"));
134 }
135 guiMainMenu.a((cgj) button);
136 List<cgj> list;
137 if (Transformer.FORGE) {
138 try {
139 list = ((List<cgj>) buttonList.get(guiMainMenu));
140 } catch (Exception e) {
141 throw new RuntimeException(e);
142 }
143 } else {
144 list = guiMainMenu.o;
145 }
146
147 for (cgj b : list) {
148 int id = b.k;
149 if (id == 2) {
150 b.f = 98;
151 }
152 }
153 }
154
155 public static void guiMainActionPerformed(Object b) {
156 cgj button = (cgj) b;

Callers

nothing calls this directly

Calls 10

getClassProxyCallbackMethod · 0.95
getVarsMethod · 0.95
isShowLastServerMethod · 0.65
getLastServerMethod · 0.65
shortenToWidthMethod · 0.65
createButtonMethod · 0.65
translateMethod · 0.65
getMethod · 0.65
parseIntMethod · 0.45
aMethod · 0.45

Tested by

no test coverage detected