-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from ZXMushroom63/main
Plugin API a5.3 Doc
- Loading branch information
Showing
12 changed files
with
418 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
# How to install a plugin | ||
|
||
<i>Please keep in mind that these plugins are fully client side and therefore work on most servers. They can be considered hacks or unfair advantages, so be careful when using them.</i> | ||
|
||
<ol> | ||
<li>Open the compiled client</li> | ||
<li>Open options</li> | ||
<li>Click 'Plugins'</li> | ||
<li>Click 'Add New'</li> | ||
<li>Paste in the .js url.</li> | ||
<li>Optional: Refresh the GUI to see if the plugin loaded correctly.</li> | ||
<li>Optional: If the plugin is not working, go to options > plugins and make sure it says 'LOADED' next to your plugin. If it doesn't, it's not my fault!!!</li> | ||
</ol> | ||
|
||
Here is a sample plugin that allows you to climb up walls like a spider: | ||
https://raw.githubusercontent.com/EaglerReborn/reborn/main/exampleplugins/spider.js | ||
|
||
And one that allows you to step up 9.5 blocks:<br> | ||
_Please keep in mind that these plugins are fully client side and therefore work on most servers. They can be considered hacks or unfair advantages, so be careful when using them._ | ||
|
||
1. Open the compiled client | ||
2. Open options | ||
3. Click 'Plugins' | ||
4. Click 'Add New' | ||
5. Paste in the .js url. | ||
6. Optional: Refresh the GUI to see if the plugin loaded correctly. | ||
|
||
|
||
----- | ||
|
||
|
||
Here is a sample plugin that prevents you from taking fall damage:\ | ||
https://raw.githubusercontent.com/EaglerReborn/reborn/main/exampleplugins/nofall.js | ||
|
||
And one that allows you to step up 9.5 blocks:\ | ||
https://raw.githubusercontent.com/EaglerReborn/reborn/main/exampleplugins/step.js | ||
|
||
And finally, a grappling hook mod!:<br> | ||
And finally, a grappling hook mod!:\ | ||
https://raw.githubusercontent.com/EaglerReborn/reborn/main/exampleplugins/grapplehook.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# How to create a plugin | ||
|
||
You will need: | ||
- Knowledge of JavaScript | ||
- A code editor (I use [vscode.dev](https://vscode.dev)) | ||
- Knowledge of Minecraft | ||
|
||
## What is a plugin? | ||
A plugin is a script that is loaded by EaglerReborn on startup or when added. It can do anythin regular JavaScript do, as well as access the [Plugin API](../plugindocs/README.md). | ||
|
||
<details> | ||
<summary> | ||
How to make an example "Spider" hack plugin | ||
</summary> | ||
|
||
## How to make an example "Spider" hack plugin | ||
|
||
Spider is a hack that allows you to climb up walls like a spider. | ||
|
||
Create a new file with the `.js` extension, and open it in your code editor. | ||
|
||
We will start by [requiring](../plugindocs/README.md#using-non-auto-properties) the player. | ||
Requiring allows us to access non-automatic properties of the Plugin API. | ||
|
||
Add this line of code: | ||
```javascript | ||
PluginAPI.require("player"); | ||
``` | ||
This will allow us to access the player. | ||
|
||
|
||
Now, we need to add a listener that will run code every game tick.\ | ||
Make a function. (Name it whatever you want) | ||
```javascript | ||
function spiderListener() { | ||
|
||
} | ||
``` | ||
|
||
Inside this function we will do two things: | ||
- Check if the player is walking in to a wall | ||
- If they are, add vertical motion | ||
|
||
Let's start with checking if the player is walking in to a wall.\ | ||
In the function you just made, add an `if` block. | ||
```javascript | ||
if () { | ||
|
||
} | ||
``` | ||
|
||
We can check whether or not the player is walking in to a wall with `PluginAPI.player.isCollidedHorizontally`. | ||
```javascript | ||
if (PluginAPI.player.isCollidedHorizontally) { | ||
|
||
} | ||
``` | ||
|
||
Now to add the vertical motion, we change the `motionY` property of `PluginAPI.player`.\ | ||
I will use the `+=` operator, which adds an amount to a variable. | ||
|
||
In the if, add these lines: | ||
```javascript | ||
PluginAPI.player.motionY += 0.2; | ||
PluginAPI.player.reload(); | ||
``` | ||
|
||
You can change the `0.2` to something larger or smaller if you want. The `reload()` call is used to tell the Plugin API to update the in-game values, so we can see our changes. | ||
|
||
Finally, we need to add the listener. | ||
```javascript | ||
PluginAPI.addEventListener("update", spiderListener); | ||
``` | ||
This tells the Plugin API to run `spiderListener` every game update (or tick). | ||
|
||
Your finished code should somewhat look like this: | ||
```javascript | ||
function spiderListener() { | ||
if (PluginAPI.player.isCollidedHorizontally) { | ||
PluginAPI.player.motionY += 0.2; | ||
PluginAPI.player.reload(); | ||
} | ||
} | ||
PluginAPI.addEventListener("update", spiderListener); | ||
``` | ||
|
||
Now, open the EaglerReborn client. | ||
Go to Options > Plugins and press "upload". | ||
Select the plugin file. | ||
|
||
Now, when joining a server (without an anti-cheat), you should be able to climb up walls like a spider. | ||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.