Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Placing the bed on the grass path changes the grass path to dirt despite canceling the event #4242

Closed
hintikulus opened this issue Aug 29, 2020 · 3 comments
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. version: 1.16 Game version 1.16

Comments

@hintikulus
Copy link

hintikulus commented Aug 29, 2020

What behaviour is expected:

When placing a bed in a protected area (Residence, WorldGuard, ...) on a grass path, the event is canceled before the grass path changes to dirt.

What behaviour is observed:

When placing a bed in a protected area (Residence, WorldGuard, ...) on a grass path, the grass path changes to a dirt. After the event is canceled, the dirt does not change back to the grass path.

Steps/models to reproduce:

Cancel the event of placing a bed and try to place the bed on a grass path.

Plugin list:

After a few tests, I stayed on the server only with my own simple plugin that cancels events of placing beds.

Paper version:

[11:26:52 INFO]: This server is running Paper version git-Paper-160 (MC: 1.16.2) (Implementing API version 1.16.2-R0.1-SNAPSHOT)

@chickeneer chickeneer added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. and removed status: needs triage labels Aug 29, 2020
@chickeneer
Copy link
Contributor

Probably related. When a bed block place is cancelled. The console receives the error
[11:53:18 ERROR]: POI data mismatch: never registered at BlockPosition{x=92, y=64, z=-233}
where that block position is at the head of the bed to be placed (and cancelled)

@chickeneer
Copy link
Contributor

Okay. I have done some investigating. Not found the solution yet though, but will provide my analysis if someone else has time.

The POI error I mentioned. Is due to nms.World#notifyAndUpdatePhysics calling this.a(blockposition, iblockdata1, iblockdata2); during the end of that method.
The source of this notify/physics is from Bukkit reverting the BlockMultiPlaceEvent captured blocks. blockstate.update(true, false); in nms.ItemStack#placeItem.
The stack from the POI error is roughly https://gist.github.com/chickeneer/a35241aba0f7ed748f21bafae6206796 (not particularly helpful here).
The solution to the POI error is to put the this.a behind one of the physics flags in that flag. ?Probably...

The reported bug (grass path to dirt) is a completely separate issue. For some reason, the grass path is being added to the block tick list for the tick after the cancelled placement. The 'cause' is in BlockGrassPath#tickAlways which doesn't have ANY validation whether to fade or not fade. It just does it.
A solution might be to wrap the fade call similar to BlockSoil#tickAlways does it.

@chickeneer
Copy link
Contributor

Closing this as resolved from upstream update.
Upstream's change: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/b8ee6a89fd17f377a356cdd88be1453389cc647f

Paper commit:
5489003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. upstream: bukkit Issues exists in Bukkit and/or CraftBukkit. version: 1.16 Game version 1.16
Projects
None yet
Development

No branches or pull requests

3 participants