PaperMC / PaperMC/Paper

Inventory desync & block update happening when canceling lily pad in BlockPlaceEvent

Open
#9,504 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected behavior

The lily pad item to remain in my inventory (without ghosting) & block updates to not happen when canceling the placement of a lily pad on water

Observed/Actual behavior

When a lily pad is placed on water and the BlockPlaceEvent is canceled, the item ghosts out of the player's inventory and a block update happens.
https://github.com/PaperMC/Paper/assets/13612979/78b1558e-c8f5-4d33-bdf3-5e8f53f74295

Steps/models to reproduce
  1. Install test plugin
  2. Create a floating body of water
  3. Place a lily pad on the water, observe item ghosted out of inventory & block update happened, causing water to flow
  4. Place a block on top of the water, no block update happened nor did the item go invisible
Plugin and Datapack List

WorldEdit + test plugin:

@EventHandler(ignoreCancelled = true)
public void onBlockPlace(BlockPlaceEvent event) {
    if (event.getBlock().getType().equals(Material.LILY_PAD)) {
        event.getPlayer().sendPlainMessage("Lilypad placed and canceled");
        event.setCancelled(true);
    }
    if (event.getBlock().getType().equals(Material.STONE)) {
        event.getPlayer().sendPlainMessage("Stone placed and canceled");
        event.setCancelled(true);
    }
}
Paper version

This server is running Paper version git-Paper-83 (MC: 1.20.1) (Implementing API version 1.20.1-R0.1-SNAPSHOT) (Git: c793bd9)
You are running the latest version

Other

No response

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

Reproduce the canceled lily-pad placement with the test plugin described in the issue, then compare its inventory and block-update behavior with canceled stone placement. Done means the lily pad remains synchronized in the inventory and canceling its placement does not trigger a block update or water flow.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.