PaperMC / PaperMC/Paper

Updating furnace snapshot in FurnaceSmeltEvent dupes items

Open
#4,853 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What behaviour is expected:

I can modify the furnace snapshot and then update the block just fine.

What behaviour is observed:

Just getting block state snapshot and updating the block causes it
FurnaceSmeltEventBug

Steps/models to reproduce:

Use following code (Compiled plugin: toiletpaper.jar)

class FurnaceSpeedListener(private val plugin: ToiletPaper) : Listener {
    @EventHandler
    public fun onFurnaceSmelt(event: FurnaceSmeltEvent) {
        plugin.logger.info("Let's smelt!")
        val furnace = event.block.getState(true) as? Furnace ?: return
        if (furnace.update())
            plugin.logger.info("Furnace updated")
        else
            plugin.logger.info("Unable to update furnace")
    }
}

If you'll get the state without using snapshot, the code works just fine.

Plugin list:

Just the plugin listed above

Paper version:
[11:54:26 INFO]: This server is running Paper version git-Paper-314 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)
[11:54:26 INFO]: Checking version, please wait...
[11:54:26 INFO]: Previous version: git-Paper-312 (MC: 1.16.4)
[11:54:26 INFO]: You are running the latest version
Anything else:

If you take out the smelted item, new one will appear - but the input slot never goes down, and never more than 1 item appears in the output.

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 by reproducing the issue with the FurnaceSmeltEvent listener and the event.block.getState(true) followed by Furnace.update(). Inspect the FurnaceSmeltEvent handling and the snapshot/update path to compare it with retrieving the state without a snapshot. Done means updating the snapshot no longer duplicates the smelted item, the input slot decreases, and the output remains correct.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.