From 9832f860d0c119ff2c405d5e7835732ac7c6de6d Mon Sep 17 00:00:00 2001 From: leguan Date: Sat, 4 May 2024 16:04:24 +0200 Subject: [PATCH] Add information about 1.20.5 changes to internals to nms guide --- docs/paper/dev/misc/internal-code.mdx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/paper/dev/misc/internal-code.mdx b/docs/paper/dev/misc/internal-code.mdx index e9181a92b..02f14e733 100644 --- a/docs/paper/dev/misc/internal-code.mdx +++ b/docs/paper/dev/misc/internal-code.mdx @@ -48,6 +48,13 @@ of Paper. This is unlikely to be the case in most production environments. This include the version. For example, `org.bukkit.craftbukkit.v1_20_R2.CraftServer` is the full class and package name for the CraftServer class in version 1.20.2. You can access these classes easily with some reflection utilities. +:::warning[Removal of relocation in 1.20.5] + +As of 1.20.5, the versioned relocation of the CraftBukkit package was removed and +CraftBukkit packages are now located in `org.bukkit.craftbukkit` and not in `org.bukkit.craftbukkit.`. + +::: + ```java private static final String CRAFTBUKKIT_PACKAGE = Bukkit.getServer().getClass().getPackage().getName(); @@ -67,6 +74,13 @@ it makes the code easier to understand. ### Mojang-Mapped Servers +:::info[Mojang-mapped runtime as of 1.20.5] + +As of 1.20.5, Paper ships with a Mojang-mapped runtime instead of reobfuscating the server to Spigot mappings. +For more information, see the [plugin remapping](./project-setup#plugin-remapping) section and [userdev](./userdev#1205-and-beyond) documentation covering these changes. + +::: + Running a Mojang-Mapped (moj-map) server is an excellent way to streamline your processes because you can develop using the same mappings that will be present at runtime. This eliminates the need for remapping in your compilation. If you are creating custom plugins for your server, we highly recommend running a moj-map server. It simplifies debugging and @@ -95,7 +109,7 @@ int dataVersion = Bukkit.getUnsafe().getDataVersion(); :::danger[Parsing the version] -You should not parse the version from the package name of classes. This is because CraftBukkit may not be relocated -in the future. +Parsing the version from the package name of classes is no longer possible as of 1.20.5 as Paper stopped relocating the CraftBukkit package. +See the [reflection](#reflection) section for more information. :::