add update event
This commit is contained in:
parent
00d76e5f27
commit
9d12dfb8e2
|
@ -30,7 +30,11 @@
|
||||||
|
|
||||||
+ this.statWriter = statWriter;
|
+ 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)
|
~ if (((sendQueue.getNetworkManager() instanceof ClientIntegratedServerNetworkManager)
|
||||||
~ || (sendQueue.getNetworkManager() instanceof LANClientNetworkManager))
|
~ || (sendQueue.getNetworkManager() instanceof LANClientNetworkManager))
|
||||||
|
|
|
@ -17,12 +17,12 @@ class GlobalsListener {
|
||||||
void onUpdate();
|
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);
|
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);
|
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);
|
static native void provideUpdateCallback(UpdateHandler handler);
|
||||||
}
|
}
|
|
@ -59,6 +59,10 @@ public class ModAPI {
|
||||||
this.mc = mcIn;
|
this.mc = mcIn;
|
||||||
requiredList = new ArrayList<String>();
|
requiredList = new ArrayList<String>();
|
||||||
initAPI(version);
|
initAPI(version);
|
||||||
|
newEvent("update");
|
||||||
|
globalsFunctor(this);
|
||||||
|
globalsRequireFunctor(this);
|
||||||
|
globalsUpdateFunctor(this);
|
||||||
getModAPI().setCallbackVoidWithDataArg("displayToChat", (BaseData params) -> {
|
getModAPI().setCallbackVoidWithDataArg("displayToChat", (BaseData params) -> {
|
||||||
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(params.getString("msg")));
|
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(params.getString("msg")));
|
||||||
});
|
});
|
||||||
|
@ -112,5 +116,6 @@ public class ModAPI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
|
ModAPI.callEvent("update", new ModData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue