add update event
This commit is contained in:
parent
00d76e5f27
commit
9d12dfb8e2
|
@ -30,7 +30,11 @@
|
|||
|
||||
+ this.statWriter = statWriter;
|
||||
|
||||
> CHANGE 116 : 123 @ 116 : 117
|
||||
> INSERT 19 : 20 @ 19
|
||||
|
||||
+ mc.modapi.onUpdate();
|
||||
|
||||
> CHANGE 97 : 104 @ 97 : 98
|
||||
|
||||
~ if (((sendQueue.getNetworkManager() instanceof ClientIntegratedServerNetworkManager)
|
||||
~ || (sendQueue.getNetworkManager() instanceof LANClientNetworkManager))
|
||||
|
|
|
@ -17,12 +17,12 @@ class GlobalsListener {
|
|||
void onUpdate();
|
||||
}
|
||||
|
||||
@JSBody(params = { "handler" }, script = "window.PluginAPI.globals.onGlobalsUpdate = handler;")
|
||||
@JSBody(params = { "handler" }, script = "window.ModAPI.globals.onGlobalsUpdate = handler;")
|
||||
static native void provideCallback(GlobalsHandler handler);
|
||||
|
||||
@JSBody(params = { "handler" }, script = "window.PluginAPI.globals.onRequire = handler;")
|
||||
@JSBody(params = { "handler" }, script = "window.ModAPI.globals.onRequire = handler;")
|
||||
static native void provideRequireCallback(GlobalsHandler handler);
|
||||
|
||||
@JSBody(params = { "handler" }, script = "window.PluginAPI.update = handler;")
|
||||
@JSBody(params = { "handler" }, script = "window.ModAPI.update = handler;")
|
||||
static native void provideUpdateCallback(UpdateHandler handler);
|
||||
}
|
|
@ -59,6 +59,10 @@ public class ModAPI {
|
|||
this.mc = mcIn;
|
||||
requiredList = new ArrayList<String>();
|
||||
initAPI(version);
|
||||
newEvent("update");
|
||||
globalsFunctor(this);
|
||||
globalsRequireFunctor(this);
|
||||
globalsUpdateFunctor(this);
|
||||
getModAPI().setCallbackVoidWithDataArg("displayToChat", (BaseData params) -> {
|
||||
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(params.getString("msg")));
|
||||
});
|
||||
|
@ -112,5 +116,6 @@ public class ModAPI {
|
|||
}
|
||||
|
||||
public void onUpdate() {
|
||||
ModAPI.callEvent("update", new ModData());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue