added apis
This commit is contained in:
parent
9d12dfb8e2
commit
d49fae080d
|
@ -0,0 +1,14 @@
|
|||
package me.otterdev;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// OG code by Ran
|
||||
// uwuifies any sentence/word!
|
||||
// Usage:
|
||||
// UwUAPI.uwuify("Your text here");
|
||||
public class UwUAPI {
|
||||
public static String uwuify(String stringToUwuify) {
|
||||
return stringToUwuify.toLowerCase().replaceAll("r|l","w").replaceAll("n([aeiou])", "ny$1").replaceAll("ove", "uve").replaceAll("uck", "uwq").replaceFirst("i", "i-i").replaceFirst("(?s)(.*)" + "i-i-i", "$1" + "i-i") + ((new Random().nextInt(10)) <= 2 ? " >_<" : "");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package net.eaglerforge.api;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
|
||||
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
|
||||
|
||||
public class LoggerAPI {
|
||||
public static final Logger log = LogManager.getLogger();
|
||||
public static ModData makeModData() {
|
||||
ModData loggerGlobal = new ModData();
|
||||
loggerGlobal.setCallbackVoidWithDataArg("loginfo", (BaseData params) -> {
|
||||
log.info(params.getString("string"));
|
||||
});
|
||||
|
||||
loggerGlobal.setCallbackVoidWithDataArg("logdebug", (BaseData params) -> {
|
||||
log.debug(params.getString("string"));
|
||||
});
|
||||
|
||||
loggerGlobal.setCallbackVoidWithDataArg("logerror", (BaseData params) -> {
|
||||
log.error(params.getString("string"));
|
||||
});
|
||||
|
||||
loggerGlobal.setCallbackVoidWithDataArg("logwarn", (BaseData params) -> {
|
||||
log.warn(params.getString("string"));
|
||||
});
|
||||
|
||||
loggerGlobal.setCallbackVoidWithDataArg("logfatal", (BaseData params) -> {
|
||||
log.fatal(params.getString("string"));
|
||||
});
|
||||
|
||||
loggerGlobal.setCallbackVoidWithDataArg("logtrace", (BaseData params) -> {
|
||||
log.trace(params.getString("string"));
|
||||
});
|
||||
return loggerGlobal;
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.util.ChatComponentText;
|
||||
import org.teavm.jso.JSBody;
|
||||
import org.teavm.jso.JSObject;
|
||||
import me.otterdev.UwUAPI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
@ -66,6 +67,9 @@ public class ModAPI {
|
|||
getModAPI().setCallbackVoidWithDataArg("displayToChat", (BaseData params) -> {
|
||||
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(params.getString("msg")));
|
||||
});
|
||||
getModAPI().setCallbackStringWithDataArg("uwuify", (BaseData params) -> {
|
||||
return UwUAPI.uwuify(params.getString("string"));
|
||||
});
|
||||
getModAPI().setCallbackVoid("clickMouse", () -> {
|
||||
mc.clickMouse();
|
||||
});
|
||||
|
@ -75,26 +79,13 @@ public class ModAPI {
|
|||
getModAPI().set("clientBrand", ClientBrandRetriever.getClientModName());
|
||||
|
||||
setGlobal("mcinstance", mc);
|
||||
getModAPI().setCallbackVoidWithDataArg("log", (BaseData params) -> {
|
||||
if (params.getString("type") == "info"){
|
||||
log.info(params.getString("msg"));
|
||||
}
|
||||
if (params.getString("type") == "debug"){
|
||||
log.debug(params.getString("msg"));
|
||||
}
|
||||
if (params.getString("type") == "error"){
|
||||
log.error(params.getString("msg"));
|
||||
}
|
||||
if (params.getString("type") == "warn"){
|
||||
log.warn(params.getString("msg"));
|
||||
}
|
||||
if (params.getString("type") == "fatal"){
|
||||
log.fatal(params.getString("msg"));
|
||||
}
|
||||
});
|
||||
getModAPI().setCallbackVoidWithDataArg("drawStringWithShadow", (BaseData params) -> {
|
||||
setGlobal("platform", PlatformAPI.makeModData());
|
||||
setGlobal("logger", LoggerAPI.makeModData());
|
||||
|
||||
|
||||
/* getModAPI().setCallbackVoidWithDataArg("drawStringWithShadow", (BaseData params) -> {
|
||||
mc.ingameGUI.getFontRenderer().drawStringWithShadow(params.getString("msg"), params.getFloat("x"), params.getFloat("y"), params.getInt("color"));
|
||||
});
|
||||
});*/
|
||||
ModGUI.loadFont();
|
||||
}
|
||||
static void globalsFunctor(ModAPI modAPI) {
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package net.eaglerforge.api;
|
||||
|
||||
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
|
||||
import org.teavm.jso.JSBody;
|
||||
|
||||
// this is me.otterdev.PlatformAPI but modified to have more features and be more optimized
|
||||
public class PlatformAPI {
|
||||
|
||||
@JSBody(params = { }, script = "return navigator.platform;")
|
||||
public static native boolean getplatformOS();
|
||||
public static ModData makeModData() {
|
||||
ModData platformGlobal = new ModData();
|
||||
platformGlobal.setCallbackBoolean("isOfflineDownload", () -> {
|
||||
return EagRuntime.isOfflineDownloadURL();
|
||||
});
|
||||
platformGlobal.setCallbackFloat("freeMemory", () -> {
|
||||
return EagRuntime.freeMemory();
|
||||
});
|
||||
platformGlobal.setCallbackFloat("maxMemory", () -> {
|
||||
return EagRuntime.maxMemory();
|
||||
});
|
||||
platformGlobal.setCallbackFloat("totalMemory", () -> {
|
||||
return EagRuntime.totalMemory();
|
||||
});
|
||||
platformGlobal.setCallbackVoidWithDataArg("openLink", (BaseData params) -> {
|
||||
EagRuntime.openLink(params.getString("url"));
|
||||
});
|
||||
platformGlobal.setCallbackString("getClipboard", () -> {
|
||||
return EagRuntime.getClipboard();
|
||||
});
|
||||
platformGlobal.setCallbackBoolean("recSupported", () -> {
|
||||
return EagRuntime.recSupported();
|
||||
});
|
||||
platformGlobal.setCallbackString("getRecText", () -> {
|
||||
return EagRuntime.getRecText();
|
||||
});
|
||||
platformGlobal.setCallbackVoid("toggleRec", () -> {
|
||||
EagRuntime.toggleRec();
|
||||
});
|
||||
platformGlobal.setCallbackBoolean("getPlatformOS", () -> {
|
||||
//return EagRuntime.getPlatformOS();
|
||||
return getplatformOS();
|
||||
});
|
||||
return platformGlobal;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue