|
16 | 16 |
|
17 | 17 | package clientapi.load.mixin; |
18 | 18 |
|
19 | | -import clientapi.Client; |
20 | 19 | import clientapi.ClientAPI; |
21 | | -import clientapi.config.ClientConfiguration; |
22 | | -import clientapi.config.JsonConfiguration; |
23 | 20 | import clientapi.event.defaults.game.core.*; |
24 | 21 | import clientapi.event.defaults.game.render.GuiDisplayEvent; |
25 | 22 | import clientapi.event.defaults.game.world.WorldEvent; |
26 | | -import clientapi.event.handle.ClientHandler; |
27 | | -import clientapi.load.ClientInitException; |
28 | 23 | import clientapi.load.mixin.extension.IMinecraft; |
29 | 24 | import clientapi.util.io.MouseKeyTracker; |
30 | | -import clientapi.util.render.gl.GLUtils; |
31 | 25 | import me.zero.alpine.event.EventState; |
32 | 26 | import net.minecraft.client.Minecraft; |
33 | 27 | import net.minecraft.client.gui.GuiScreen; |
|
45 | 39 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
46 | 40 |
|
47 | 41 | import javax.annotation.Nullable; |
48 | | -import java.io.InputStream; |
49 | | -import java.lang.reflect.Constructor; |
50 | | -import java.lang.reflect.InvocationTargetException; |
51 | 42 |
|
52 | 43 | import static clientapi.event.defaults.game.core.ClickEvent.MouseButton.*; |
53 | 44 |
|
@@ -152,42 +143,7 @@ private void onMouseEvent(CallbackInfo info) { |
152 | 143 | at = @At("RETURN") |
153 | 144 | ) |
154 | 145 | private void init(CallbackInfo ci) { |
155 | | - InputStream stream = this.getClass().getResourceAsStream("/client.json"); |
156 | | - |
157 | | - if (stream == null) |
158 | | - throw new ClientInitException("Unable to locate Client Configuration"); |
159 | | - |
160 | | - // Construct a ClientConfiguration object from the client json using GSON |
161 | | - ClientConfiguration clientConfig = JsonConfiguration.loadConfiguration(stream, ClientConfiguration.class); |
162 | | - |
163 | | - if (clientConfig == null) |
164 | | - throw new ClientInitException("Unable to create Client Configuration from client.json"); |
165 | | - |
166 | | - // Attempt to instantiate the specified class from the client configuration |
167 | | - Client client; |
168 | | - try { |
169 | | - Class<?> clientClass = Class.forName(clientConfig.getMainClass()); |
170 | | - Constructor<?> constructor; |
171 | | - if (clientClass != null && clientClass.getSuperclass().equals(Client.class) && (constructor = clientClass.getConstructor(ClientConfiguration.class)) != null) { |
172 | | - client = (Client) constructor.newInstance(clientConfig); |
173 | | - } else { |
174 | | - throw new ClientInitException("Client class is null or the superclass is not Client type"); |
175 | | - } |
176 | | - } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { |
177 | | - throw new ClientInitException("Unable to instantiate main client class"); |
178 | | - } catch (ClassNotFoundException e) { |
179 | | - throw new ClientInitException("Unable to find client class"); |
180 | | - } catch (NoSuchMethodException e) { |
181 | | - throw new ClientInitException("Unable to find constructor with valid parameters"); |
182 | | - } |
183 | | - |
184 | | - // Init GLUtils |
185 | | - GLUtils.init(); |
186 | | - |
187 | | - // Init client |
188 | | - client.init(); |
189 | | - |
190 | | - ClientAPI.EVENT_BUS.subscribe(ClientHandler.INSTANCE); |
| 146 | + ClientAPI.start(); |
191 | 147 | } |
192 | 148 |
|
193 | 149 | @ModifyVariable( |
|
0 commit comments