|
2 | 2 |
|
3 | 3 | The Hypixel Mod API is an implementation of custom packets for communicating with the Hypixel Server via plugin messages.
|
4 | 4 |
|
5 |
| -At this time the API is in an early preview state to obtain feedback from the community. The API is subject to change and may be changed or disabled at any time. You can read more about on the [announcement forum thread](https://hypixel.net/threads/hypixel-mod-api-developer-preview-feedback.5635119/). |
| 5 | +Currently, the API is in an early preview state to gather community feedback. The API is subject to change and may be |
| 6 | +altered or disabled at any time. You can read more about on |
| 7 | +the [announcement forum thread](https://hypixel.net/threads/hypixel-mod-api-developer-preview-feedback.5635119/). |
6 | 8 |
|
7 | 9 |
|
8 |
| -## Usage |
| 10 | +## Mod Distributions |
9 | 11 |
|
10 |
| -For using the Mod API it is highly recommended to relocate the package `net.hypixel` to prevent conflicting with other mods and different versions of the Mod API. |
| 12 | +Official downloads of the Hypixel Mod API can be found on [Modrinth](https://modrinth.com/mod/hypixel-mod-api). |
| 13 | +To install the mod, simply download the JAR file and place it in your mods folder. |
11 | 14 |
|
12 |
| -You can use this API as a dependency via the public Hypixel maven repo. |
| 15 | +Currently, the Hypixel Mod API supports the following mod loaders and versions: |
13 | 16 |
|
14 |
| -#### Hypixel Maven Repo |
| 17 | +- Fabric 1.20.5/1.20.6 |
| 18 | + |
| 19 | +There are also plans to add support for the following versions before a full release: |
| 20 | + |
| 21 | +- Forge 1.20.6 |
| 22 | +- Forge 1.8.9 |
| 23 | + |
| 24 | +If there is significant demand, support for additional versions and loaders may be considered. |
| 25 | + |
| 26 | + |
| 27 | +## Developer Usage |
| 28 | + |
| 29 | +For using the Mod API you will need to add it as a dependency to your project. This can be done via the public |
| 30 | +Hypixel Maven repository. |
15 | 31 |
|
16 | 32 | ```xml
|
17 | 33 | <repository>
|
@@ -43,3 +59,43 @@ dependencies {
|
43 | 59 | implementation 'net.hypixel:mod-api:0.3.2'
|
44 | 60 | }
|
45 | 61 | ```
|
| 62 | + |
| 63 | +Depending on your chosen mod loader, you will need to also include the `hypixel-mod-api` as a required dependency. For example in Fabric you would include the following in your `fabric.mod.json` file. |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "depends": { |
| 68 | + "hypixel-mod-api": ">=0.3.2" |
| 69 | + } |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +## Example Usage |
| 74 | + |
| 75 | +Once you have the API added to your project you can start using it. Below are examples of sending server-bound packets, as well as receiving client-bound packets. |
| 76 | + |
| 77 | +### Sending a Hypixel Packet |
| 78 | + |
| 79 | +```java |
| 80 | +public class Example { |
| 81 | + public void sendPacket() { |
| 82 | + HypixelModAPI.getInstance().sendPacket(new ServerboundLocationPacket()); |
| 83 | + } |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +### Registering a packet handler |
| 88 | + |
| 89 | +```java |
| 90 | + |
| 91 | +public class Example { |
| 92 | + public void registerPacketHandler() { |
| 93 | + HypixelModAPI.getInstance().registerHandler(new ClientboundPacketHandler() { |
| 94 | + @Override |
| 95 | + public void onLocationPacket(ClientboundLocationPacket packet) { |
| 96 | + packet.getServerName(); |
| 97 | + } |
| 98 | + }); |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
0 commit comments