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

Method patchMainMenu

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

Source from the content-addressed store, hash-verified

95 }
96
97 public static void patchMainMenu(Object instance, int paramInt1, int paramInt2, boolean isForge) {
98 bht guiMainMenu = (bht) instance;
99 if (!MinecraftFactory.getClassProxyCallback().isShowLastServer())
100 return;
101 String lastServer;
102 IButton button;
103 String server = MinecraftFactory.getClassProxyCallback().getLastServer();
104 int x = guiMainMenu.l / 2 + 2;
105 int y = paramInt1 + paramInt2;
106 if (server != null) {
107 String[] parts = server.split(":");
108 String host = parts[parts.length - 2];
109 int port = Integer.parseInt(parts[parts.length - 1]);
110 if (port == 25565) {
111 lastServer = host;
112 } else {
113 lastServer = host + ":" + port;
114 }
115 lastServer = MinecraftFactory.getVars().shortenToWidth(lastServer, 88);
116 button = MinecraftFactory.getVars().createButton(99, x, y, 98, 20, lastServer);
117 } else {
118 button = MinecraftFactory.getVars().createButton(98, x, y, 98, 20, MinecraftFactory.getClassProxyCallback().translate("menu.no_last_server"));
119 }
120 List<bfk> list;
121 if (Transformer.FORGE) {
122 try {
123 list = ((List<bfk>) buttonList.get(guiMainMenu));
124 } catch (Exception e) {
125 throw new RuntimeException(e);
126 }
127 } else {
128 list = guiMainMenu.n;
129 }
130 list.add((bfk) button);
131
132 for (bfk b : list) {
133 int id = b.k;
134 if (id == 2) {
135 b.f = 98;
136 }
137 }
138 }
139
140 public static void guiMainActionPerformed(Object b) {
141 bfk button = (bfk) 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
addMethod · 0.45

Tested by

no test coverage detected