Skip to content

Commit 8256dff

Browse files
authored
Merge pull request #200 from SatoTsukasaCode/feat/browsing-serverjar
feat: added patcher guide
2 parents e0ff2f3 + 0cfecd0 commit 8256dff

5 files changed

Lines changed: 73 additions & 9 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
title: Browsing the server.jar code
3+
description: Learn how to patch the server.jar and browse the source code.
4+
---
5+
6+
The ~~patcher~~ allows you to more easily prepare an environment for exploring the Hytale Server without publishing the decompiled code.
7+
8+
9+
## Setup
10+
11+
* Clone the patcher `git clone https://github.com/HytaleModding/patcher.git`, and enter the directory. `cd patcher`
12+
13+
* Create a Python virtual environment in the `.venv` folder. The command for this varies by platform but it is probably
14+
one of these:
15+
- `python -m venv .venv`
16+
- `python3 -m venv .venv` (Linux)
17+
- `py -3.13 -m venv .venv` (Windows)
18+
19+
In the last one, specifying the version is recommended if you have multiple Pythons installed.
20+
21+
* Activate the virtual environment:
22+
- Windows: `".venv\Scripts\activate"` (including the quotes)
23+
- Linux/Mac: `source .venv/bin/activate`
24+
- From now on, you are running python commands from inside the venv, hence you must use `python` instead of `py` or `python3` to invoke python.
25+
26+
* Inside the venv, you have to install the dependencies
27+
- `pip install -r requirements.txt`
28+
29+
* Install these dependencies and ensure they are on PATH:
30+
- `git`
31+
- `java` you need JDK 25 or newer
32+
- `jar` (comes with JDK inside the bin folder)
33+
- `mvn`
34+
35+
36+
## Usage
37+
38+
Put your HytaleServer.jar in the same root directory of this repo or specify an environment variable `HYTALESERVER_JAR_PATH` with the path to your HytaleServer.jar
39+
40+
Then run this:
41+
```shell
42+
python run.py setup
43+
```
44+
It will
45+
- copy the HytaleServer.jar into `work/download`
46+
* (on Windows) fix `META-INF/license` name collision
47+
- decompile it using Fernflower and save the output to `work/decompile`
48+
- set up a Maven project in `hytale-server` with the decompiled code
49+
50+
You can then open the `hytale-server` folder in your favorite IDE and begin exploring the code. For *IntelliJ IDEA*,
51+
you must first set up the SDK. After opening the project (you can open the `pom.xml` file, IDEA will prompt you to open
52+
the entire project) press Ctrl+Alt+Shift+S and under _Project_ configure SDK and Language level to *25*.
53+
54+
If IDEA does not offer an option to run the main file, right-click the `src` folder -> Mark Directory As -> Sources Root
55+
then reload the maven project:
56+
![_readme_images/img.png](/assets/reload-maven.png)
57+
It is located in the "m" icon on the right side:
58+
![_readme_images/m.png](/assets/maven.png)
59+
If you don't see it, enable it under View -> Tool Windows -> Maven.
60+
![_readme_images/tool_windows.png](/assets/view-windowtools-maven.png)
61+
62+
63+
This decompiled code is likely broken. But it is somewhat usable for exploration. Try Ctrl+Shift+F and search PacketAdapters
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
2-
"title": "Server Plugins",
3-
"pages": [
4-
"setting-up-env.mdx",
5-
"creating-commands.mdx",
6-
"creating-events.mdx",
7-
"chat-formatting.mdx",
8-
"..."
9-
],
10-
"icon": "Terminal"
2+
"title": "Server Plugins",
3+
"pages": [
4+
"setting-up-env.mdx",
5+
"browsing-serverjar.mdx",
6+
"creating-commands.mdx",
7+
"creating-events.mdx",
8+
"chat-formatting.mdx",
9+
"..."
10+
],
11+
"icon": "Terminal"
1112
}

public/assets/maven.png

7.89 KB
Loading

public/assets/reload-maven.png

12.6 KB
Loading
138 KB
Loading

0 commit comments

Comments
 (0)