PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
9.67k stars 2.25k forks source link

Server JAR missing reference to com.mojang.serialization.Keyable #9085

Closed njsharpe closed 1 year ago

njsharpe commented 1 year ago

Expected behavior

A successfully compiled & jarred plugin via gradle.

Observed/Actual behavior

"Error: Cannot access Keyable ... class file for com.mojang.serialization.Keyable not found"

Steps/models to reproduce

  1. Clone latest from PaperMC/Paper on master
  2. gradlew applyPatches
  3. gradlew createMojmapBundlerJar
  4. gradlew createMojmapPaperclipJar
  5. gradlew publishToMavenLocal
  6. Validate maven local by checking ~\.m2\repository\io\papermc\paper. Should find the following folders: paper-api, paper-server, paper-mojangapi. Apply fix to paper-server, incorrectly named jar file paper-server-<ver>-<rev>-SNAPSHOT-mojang-mapped.jar -> paper-server-<ver>-<rev>-SNAPSHOT.jar
  7. Load all into plugin with as gradle dependencies. Include remote repository for paper-api (for external dependencies like bungeecord-chat).
  8. Include code below into the project.
  9. gradlew jar

Code snippet that produced the error:

@Override
public void onEnable() {
    DefaultedRegistry<Potion> repository = BuiltInRegistries.POTION;
    Optional<Potion> optional = registry.getOptional(ResourceLocation.tryParse("minecraft:long_fire_resistance"));
}

Errors out when attempting Registry#getOptional(ResourceLocation) since Registry<T> implements Keyable, which is not included in the paper-server dependency, where it should be. I believe this is unintended behavior.

Plugin and Datapack List

N/A

Paper version

[16:27:56 INFO]: Checking version, please wait... [16:27:57 INFO]: This server is running Paper version git-Paper-"9893e2b" (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 9893e2b) You are running the latest version Previous version: git-Folia-"ed7a5c5" (MC: 1.19.4)

Other

No response

Machine-Maker commented 1 year ago

which is not included in the paper-server dependency, where it should be. I believe this is unintended behavior.

This is 100% intended behavior the paper-server dependency does not include all the other libraries that are bundled with the server jar provided by mojang.

Dependencies are not transitive with the paper-server artifact as that is not the supported way of access internals.

Machine-Maker commented 1 year ago

Closing as WAI for now. The only supported way of accessing server internals is with the paperweight gradle plugin.