Skip to content

PlayerBlockBreakEvents.BEFORE is run on client as well as server instead of only on server #290

Description

@MoriyaShiine

Minecraft version

26.1.x

Describe the bug

The game crashes when mods hook into PlayerBlockBreakEvents.BEFORE and run server-only code

Steps to reproduce

  1. Install Enchancement (example where it crashes)
  2. Enchant a pickaxe with Extracting
  3. Mine any set of ores to crash the game

Logs

https://gist.github.com/MoriyaShiine/56db7ea387da57cd2ae30ece60deb203

Additional context

On Fabric, this event only runs on the server, while on FFAPI, it runs on both client and server. This can cause problems because mods (such as Enchancement) expect the event to only run on the server so casting to ServerLevel is safe, but on NeoForge this is not the case.

I'm unsure if there are any other events that fall victim to this but it might be worth looking into :p

Metadata

Metadata

Assignees

Labels

26.1.xTargets Minecraft 26.1.xbugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions