ClientProxy.java
5.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/*
* This file is part of LiteLoader.
* Copyright (C) 2012-16 Adam Mummery-Smith
* All Rights Reserved.
*/
package com.mumfrey.liteloader.client;
import java.io.File;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.mumfrey.liteloader.client.ducks.IFramebuffer;
import com.mumfrey.liteloader.core.Proxy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiNewChat;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.entity.Entity;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.WorldSettings;
/**
* Proxy class which handles the redirected calls from the injected callbacks
* and routes them to the relevant liteloader handler classes. We do this rather
* than patching a bunch of bytecode into the packet classes themselves because
* this is easier to maintain.
*
* @author Adam Mummery-Smith
*/
public abstract class ClientProxy extends Proxy
{
private static LiteLoaderEventBrokerClient broker;
private ClientProxy() {}
public static void onStartupComplete()
{
Proxy.onStartupComplete();
ClientProxy.broker = LiteLoaderEventBrokerClient.getInstance();
if (ClientProxy.broker == null)
{
throw new RuntimeException("LiteLoader failed to start up properly."
+ " The game is in an unstable state and must shut down now. Check the developer log for startup errors");
}
ClientProxy.broker.onStartupComplete();
}
public static void onTimerUpdate()
{
ClientProxy.broker.onTimerUpdate();
}
public static void newTick()
{
}
public static void onTick()
{
ClientProxy.broker.onTick();
}
public static void onRender()
{
ClientProxy.broker.onRender();
}
public static void preRenderGUI(float partialTicks)
{
ClientProxy.broker.preRenderGUI(partialTicks);
}
public static void onSetupCameraTransform(int pass, float partialTicks, long timeSlice)
{
ClientProxy.broker.onSetupCameraTransform(pass, partialTicks, timeSlice);
}
public static void postRenderEntities(int pass, float partialTicks, long timeSlice)
{
ClientProxy.broker.postRenderEntities(partialTicks, timeSlice);
}
public static void postRender(float partialTicks, long timeSlice)
{
ClientProxy.broker.postRender(partialTicks, timeSlice);
}
public static void onRenderHUD(float partialTicks)
{
ClientProxy.broker.onRenderHUD(partialTicks);
}
public static void onRenderChat(GuiNewChat chatGui, float partialTicks)
{
ClientProxy.broker.onRenderChat(chatGui, partialTicks);
}
public static void postRenderChat(GuiNewChat chatGui, float partialTicks)
{
ClientProxy.broker.postRenderChat(chatGui, partialTicks);
}
public static void postRenderHUD(float partialTicks)
{
ClientProxy.broker.postRenderHUD(partialTicks);
}
public static void onCreateIntegratedServer(IntegratedServer server, String folderName, String worldName, WorldSettings worldSettings)
{
ClientProxy.broker.onStartServer(server, folderName, worldName, worldSettings);
}
public static void onOutboundChat(CallbackInfo e, String message)
{
ClientProxy.broker.onSendChatMessage(e, message);
}
public static void onResize(Minecraft mc)
{
if (ClientProxy.broker == null) return;
ClientProxy.broker.onResize(mc);
}
public static void preRenderFBO(Framebuffer frameBufferMc)
{
if (ClientProxy.broker == null) return;
if (frameBufferMc instanceof IFramebuffer)
{
((IFramebuffer)frameBufferMc).setDispatchRenderEvent(true);
}
ClientProxy.broker.preRenderFBO(frameBufferMc);
}
public static void postRenderFBO(Framebuffer frameBufferMc)
{
if (ClientProxy.broker == null) return;
ClientProxy.broker.postRenderFBO(frameBufferMc);
}
public static void renderFBO(Framebuffer frameBufferMc, int width, int height, boolean flag)
{
if (ClientProxy.broker == null) return;
ClientProxy.broker.onRenderFBO(frameBufferMc, width, height);
}
public static void onRenderWorld(float partialTicks, long timeSlice)
{
ClientProxy.broker.onRenderWorld(partialTicks, timeSlice);
}
public static void onRenderSky(int pass, float partialTicks, long timeSlice)
{
ClientProxy.broker.onRenderSky(partialTicks, pass, timeSlice);
}
public static void onRenderClouds(RenderGlobal renderGlobalIn, float partialTicks, int pass)
{
ClientProxy.broker.onRenderClouds(partialTicks, pass, renderGlobalIn);
}
public static void onRenderTerrain(int pass, float partialTicks, long timeSlice)
{
ClientProxy.broker.onRenderTerrain(partialTicks, pass, timeSlice);
}
public static void onSaveScreenshot(CallbackInfoReturnable<ITextComponent> ci, File gameDir, String name, int width, int height,
Framebuffer fbo)
{
ClientProxy.broker.onScreenshot(ci, name, width, height, fbo);
}
public static <T extends Entity> void onRenderEntity(RenderManager source, Render<T> render, T entity, double x, double y, double z,
float yaw, float pTicks)
{
ClientProxy.broker.onRenderEntity(source, entity, x, y, z, yaw, pTicks, render);
}
public static <T extends Entity> void onPostRenderEntity(RenderManager source, Render<T> render, T entity, double x, double y, double z,
float yaw, float pTicks)
{
ClientProxy.broker.onPostRenderEntity(source, entity, x, y, z, yaw, pTicks, render);
}
}