PaperMC / PaperMC/Paper

Player#openEnchanting method does not respect the world

Open
#9,943 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: unlikely type: bug
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior
Location location = new Location(Bukkit.getWorlds().get(0), 0.0, 0.0, 0.0);
player.openEnchanting(location, true);

If there is a level 30 enchanting table at this location, the player can open the level 30 enchanting table normally at any location.

Observed/Actual behavior

If the player is in the overworld, the level 30 enchanting table will be opened.
If the player is in the Nether or the End, the lowest level enchanting table will be opened.

Steps/models to reproduce

1、Place a level 30 enchanting table at 0,0,0 in the overworld
2、Travel to the Nether or the End
3、Execute the above code

Plugin and Datapack List

Only plugins for testing

Paper version

This server is running Paper version git-Paper-290 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT) (Git: f186318)
You are running the latest version

Other

https://github.com/PaperMC/Paper/blob/f186318a91cbd3b2a2259d39cb88576989a496b8/patches/server/0911-Fix-force-opening-enchantment-tables.patch#L17C141-L17C141
It looks like the world the player is in is used when opening the enchanting table, rather than the world specified by the coordinates.
All openXXX series methods have the same issue, but may only affect the enchanting table (Because it has levels)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked 0911-Fix-force-opening-enchantment-tables.patch and trace Player#openEnchanting, comparing the supplied Location world with the player's current world. Reproduce the behavior across the overworld, Nether, and End, then verify that the specified world is respected when opening the enchanting table and check whether the other openXXX methods share the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.