Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions docs/paper/dev/getting-started/userdev.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
slug: /dev/userdev
sidebar_label: Paperweight Userdev
description: A guide on how to use the Paperweight Userdev Gradle plugin to access internal code.
description: A guide on how to use the paperweight-userdev Gradle plugin to access internal code.
---

# paperweight-userdev
Expand All @@ -11,7 +11,7 @@ provides access to internal code (also known as NMS) during development.

:::note

This guide is written using the Kotlin DSL for Gradle and assumes you have some basic knowledge of Gradle.
This guide is written using the Gradle Kotlin DSL and assumes you have some basic knowledge of Gradle.
If you want to see a fully-functioning plugin that uses **paperweight-userdev**,
check out this [example plugin](https://github.com/PaperMC/paperweight-test-plugin).

Expand All @@ -21,7 +21,7 @@ check out this [example plugin](https://github.com/PaperMC/paperweight-test-plug
The Paper server jars we provide on the downloads page through the API are **paperclip** jars. These
use Spigot's mappings, which are essentially some type names, but fully obfuscated fields and methods.
This can make it hard to work with in a development environment. This plugin lets you use fully deobfuscated
types, names and fields during development, and then remaps your plugin, so it can still be used with the obfuscated
types, names, and fields during development, and then remaps your plugin, so it can still be used with the obfuscated
server.

:::caution
Expand All @@ -35,14 +35,17 @@ use non-obfuscated names in reflection.
Add the plugin to your `build.gradle.kts` file.
```kotlin
plugins {
id("io.papermc.paperweight.userdev") version "1.5.5" // the latest version can be found on the Gradle Plugin Portal
id("io.papermc.paperweight.userdev") version "1.5.10" // Check for new versions at https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev
}
```

The latest version of `paperweight-userdev` supports dev bundles for Minecraft 1.17.1 and newer, so it's best practice to keep it up to date!
Only the latest version of `paperweight-userdev` is officially supported, and we will ask you to update first if you are having problems with old versions.

:::info[Snapshots]

**paperweight-userdev** releases are available through the Gradle plugin portal, but if you
want to use SNAPSHOT versions, you must add Paper's maven repo to `settings.gradle.kts` with:
**paperweight-userdev** releases are available through the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/io.papermc.paperweight.userdev), but if you
want to use SNAPSHOT versions, you must add Paper's Maven repository to `settings.gradle.kts` with:
```kotlin
pluginManagement {
repositories {
Expand All @@ -54,7 +57,7 @@ pluginManagement {

:::

## Adding the dev-bundle dependency
## Adding the dev bundle dependency
If you try to load your Gradle project now, you will receive an error saying you have to declare
a dev bundle dependency. You can do that by adding to your `dependencies` block in your `build.gradle.kts`
file.
Expand All @@ -67,7 +70,7 @@ dependencies {
```
:::tip

You can remove any dependency for the Paper API, as the dev bundle includes that.
You should remove any dependency on the Paper API, as the dev bundle includes that.

:::

Expand Down
14 changes: 7 additions & 7 deletions docs/paper/dev/misc/internal-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ any time.

## Accessing Minecraft Internals

In order to use Mojang and CraftBukkit code, you may either use the Paperweight Userdev plugin or use reflection.
The [Paperweight Userdev](https://github.com/PaperMC/paperweight-test-plugin) plugin is the recommended way to access internal code
In order to use Mojang and CraftBukkit code, you may either use the `paperweight-userdev` Gradle plugin or use reflection.
[`paperweight-userdev`](https://github.com/PaperMC/paperweight-test-plugin) is the recommended way to access internal code
as it is easier to use due to being able to have the remapped code in your IDE. You can find
out more about this in the [Paperweight Userdev](/paper/dev/userdev) section.
out more about this in the [`paperweight-userdev`](/paper/dev/userdev) section.

However, if you are unable to use the Userdev plugin, you can use reflection.
However, if you are unable to use `paperweight-userdev`, you can use reflection.

### Reflection

Expand All @@ -59,7 +59,7 @@ Class.forName(cbClass("entity.CraftBee"));

Minecraft's code is obfuscated. This means that the names of classes and methods are changed to make them harder to
understand. Paper deobfuscates these identifiers for development; however, to provide compatibility with legacy plugins,
Paper is re-obfuscated at runtime. You can use a plugin like [Reflection Remapper](https://github.com/jpenilla/reflection-remapper) to automatically remap the
Paper is re-obfuscated at runtime. You can use a library like [reflection-remapper](https://github.com/jpenilla/reflection-remapper) to automatically remap the
reflection references. This will allow you to use the de-obfuscated, Mojang-mapped, names in your code. This is recommended as
it makes the code easier to understand.

Expand All @@ -68,15 +68,15 @@ it makes the code easier to understand.
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
allows for you to hotswap plugins.
allows you to hotswap plugins.

In the future, the Paper server will no longer undergo remapping. By adopting Mojang mappings now, you can ensure that
your plugin won't require internal remapping when we make the switch.

### Getting the current Minecraft version

You can get the current Minecraft version to allow you to use the correct code for a specific version. This can be done
with the one of the following methods:
with one of the following methods:

```java
// Example value: 1.20.2
Expand Down