You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/docs/en/guides/plugin/browsing-serverjar.mdx
+61-18Lines changed: 61 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,25 @@
1
1
---
2
2
title: Browsing the server.jar code
3
3
description: Learn how to patch the server.jar and browse the source code.
4
+
authors:
5
+
- name: "musava_ribica"
6
+
url: "https://github.com/IamMusavaRibica"
4
7
---
5
8
6
-
The ~~patcher~~allows you to more easily prepare an environment for exploring the Hytale Server without publishing the decompiled code.
9
+
Our [patcher](https://github.com/HytaleModding/patcher) tool allows you to easily prepare an environment for exploring the Hytale Server.
7
10
11
+
## Why?
8
12
9
-
## Setup
13
+
When you add a compiled jar as a library, IntelliJ only decompiles class by class and doesn't let you search it. For example, you cannot right click some class and then Find Usages. This script will give you a ready to use Hytale server code as a project where you can explore anything you want.
10
14
11
-
* Clone the patcher `git clone https://github.com/HytaleModding/patcher.git`, and enter the directory. `cd patcher`
15
+
16
+
17
+
If anything goes wrong, please ping the author in [this post](https://discord.com/channels/1440173445039132724/1460707397189238785) in the Hytale Modding discord server
18
+
19
+
20
+
## Instructions
21
+
22
+
* Clone the repository `git clone https://github.com/HytaleModding/patcher.git`, and enter the directory using `cd patcher`
12
23
13
24
* Create a Python virtual environment in the `.venv` folder. The command for this varies by platform but it is probably
14
25
one of these:
@@ -19,45 +30,77 @@ one of these:
19
30
In the last one, specifying the version is recommended if you have multiple Pythons installed.
20
31
21
32
* Activate the virtual environment:
22
-
- Windows: `".venv\Scripts\activate"` (including the quotes)
33
+
- Windows: If you're using normal command prompt, do `".venv\Scripts\activate"`and if you're using PowerShell, do `.\.venv\Scripts\activate`
23
34
- Linux/Mac: `source .venv/bin/activate`
24
35
- 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.
36
+
37
+
* You should now have `(.venv)` prefixed to the current working dir in the terminal.
25
38
26
-
* Inside the venv, you have to install the dependencies
39
+
* Inside the venv, install the dependencies
27
40
-`pip install -r requirements.txt`
28
41
29
42
* Install these dependencies and ensure they are on PATH:
30
-
-`git`
43
+
-`git` - download from [here](https://git-scm.com/install/) and make sure the `C:\Program Files\Git\cmd\` folder is on your PATH.
31
44
-`java` you need JDK 25 or newer
32
45
-`jar` (comes with JDK inside the bin folder)
33
-
-`mvn`
34
-
46
+
-`mvn` - download from [here](https://maven.apache.org/download.cgi), extract and add the `bin` folder on your PATH
35
47
36
-
## Usage
48
+
After modifying your PATH, don't forget to close existing terminals and start a new one. Verify that those tools are installed by running these commands: `git --version`, `mvn --version`, `java --version`, `jar --version`.
37
49
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
50
+
*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
51
40
52
Then run this:
41
53
```shell
42
54
python run.py setup
43
55
```
44
-
It will
56
+
57
+
What will it do:
45
58
- copy the HytaleServer.jar into `work/download`
46
59
* (on Windows) fix `META-INF/license` name collision
47
-
- decompile it using Fernflower and save the output to `work/decompile`
60
+
- decompile only the `com.hypixel` package using Vineflower and save the output to `work/decompile`
48
61
- set up a Maven project in `hytale-server` with the decompiled code
62
+
* all other libraries the server uses are added into pom.xml and you don't have to worry about them.
63
+
49
64
50
65
You can then open the `hytale-server` folder in your favorite IDE and begin exploring the code. For *IntelliJ IDEA*,
51
66
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*.
67
+
the entire project) press Ctrl+Alt+Shift+S and under _Project_ configure *SDK* and *Language level* to **25**.
68
+
69
+
This decompiled code is likely broken. But it is somewhat usable for exploration. Try Ctrl+Shift+F and search PacketAdapters. Want to figure out where is PlayerSetupConnectEvent constructed? Just find it somewhere then right click and Find Usages, and at the bottom see New instance creation.
70
+
71
+
72
+
73
+
74
+
## Adding HytaleServer as a dependency
53
75
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:
76
+
Go into `hytale-server/src/main/java` folder in your terminal (cmd or powershell). Run this command
0 commit comments