ModLoader Tools

Experimental ModLoader Tools 1.3.2

⚠This is not mine but modify the code to work with ModLoader! Except Fetch API⚠
Requirements:

How to install:
Put the ZIP file in the ModLoader folder then unzip the file and start the server and Voila! (Remember to delete the ZIP file)

How to use:
You will be able to use the Browser JavaScript APIs that are Compatible (I recommend to see the source code links)

BlobAPI.js:
Add JavaScript or Browser Blob more information: https://developer.mozilla.org/es/docs/Web/API/Blob

GlobalAPI.js:
Add console.info(); console. warn(); self, global, process, etc.

HttpAPI.js:
Add the HttpServletRequest API!.

requireAPI.js:
Add the JavaScript function require();

TimeAPI.js:
Add setTimeout, setImmediate and setInterval API and also clearTimeout, clearImmediate and clearInterval.(I don't know what it would be used for if ModLoader already implements this in its tasks, the only thing that changes is that ModLoader is in Minecraft ticks and this is in Milliseconds)

Load Jars.js
Add that we can implement libraries or Packages that we need in our Script, you only need to compile the libraries or Packages, that is, convert them to .jar files
How do I load the library?
You must use the loadJars() function:
JavaScript:
loadJars([
    //here the absolute directory in Linux is /home (you can investigate how it is in each system) in hosters it is almost always the same as the path that appears above in the file explorer
    "/home/container/Jars/MyPackage.jar"
]);
//now you can use it
var Myclass = Java.type("MyPackage.example.codeClass");
//or
var Myclass = Packages.MyPackage.example.codeClass;
⚠⚠Important this does not load Plugins only libraries or Packages⚠⚠

Fetch API.js:
Adds the Fetch Browser feature to access HTTP servers! (Also to Websites!)
⚠You need GlobalAPI.js⚠
How does it work:
Here an example of POST and GET!
JavaScript:
//How to make a GET request
var requestGET = fetch("https://theurltest.com", "GET");
console.info("The page say: " + requestGET);
//It also works without putting "GET" example:
var requestGET2 = fetch("https://theurltest.com");
console.info("The page say: " + requestGET2);
//How to make POST request
var requestPOST = fetch("https://theurltest.com", "POST", JSON.stringify({
    content: "Content you send to the server, You can also obviously add more variables as you need just like Fetch!"
}));
//If the server sends a message you can receive the message!
console.info("The server says: " + requestPOST);
To better understand this See Source Code URLs!

--⚠⚠RECOMMENDED TO USE AFTER PLUGINS LOAD UNLESS YOU ARE SURE IT WILL LOAD BEFORE THIS THAN YOUR PLUGIN!!. I Recommend Using the APIs in a ModLoader command or task! ⚠⚠--

If you want to know how to better use ModLoader I recommend you visit my blog where I talk about it:
Author
Trollhunters501
Downloads
949
Views
1,589
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from Trollhunters501

Latest updates

  1. Add Class Loader

    Now you can load Libraries, Packages in ModLoader!
  2. Update Fetch

    The fetch API was updated for more info see the fetch source code
  3. Add Fetch API

    Added a Fetch API! What exists in The Browser!

Latest reviews

Big idea. Need more functions but is much best extension
Trollhunters501
Trollhunters501
Thank you 😃
Top