Add Cause tracking for SulfurCube - #2295
Conversation
|
Thanks for this PR :) – Currently I'm wanting to hold off on bumping our requirement to 26.2 mostly to have one more final 26.1-compatible release, so I'll wait for that point before doing a proper review. From a very quick look though there are two main questions:
|
No, I guess no Paper-specific APIs were used.
As for now, and according to Minecraft Wiki, explosive archetype is achieved by consuming items with tag Moreover, sulfur cube can't explode by its own, like a creeper. Cube loses ability to move after consuming item, so, cube requires any external action like igniting or pushing to redstone blocks to perform an explosion. That's why I treating sulfur cube as TNT in explosion-related events |
|
Makes sense, thanks :) – Are you able to please now rebase? I've made the required changes for WorldGuard to target MC 26.2, which will likely conflict with some parts of this PR as it was also partially done here. |
| * @return true if sulfur cube | ||
| */ | ||
| public static boolean isSulfurCube(Entity entity) { | ||
| return entity instanceof SulfurCube; |
There was a problem hiding this comment.
Do we actually need this method here? It seems to just be used once, and is just a simple instanceof check that's unlikely to ever expand in the future. If this was "is an explodeable sulfur cube" it'd make more sense to have a utility method like this, but I'm unsure if it has much merit existing in its current state
This PR fixes #2294.
Explosive archetype of sulfur cube is dangerous by default and cause damage to blocks. Sulfur cubes can transform to explosive by consuming a TNT block: from player's direct interaction or by grabbing dropped item. Damage from sulfur cube may be disabled with
other-explosion: DENYflag, but there is no fun to disable it everywhere.This PR brings more consistent approach: sulfur cube with TNT acts like normal tnt and explosive minecarts at once. I added Cause tracking for every interaction. Insertion block by player will track the root cause of possible destruction. This means that sulfur cube with TNT inserted by non-MEMBER and pushed to protected region would not harm any blocks. Even feeding a cube with TNT-item within protected region and pushing to any redstone block will be safe for region, because cube itself will treated as non-MEMBER. But cube, created by MEMBER or OWNER still can explode blocks if flag
tntis not set to DENY.But there are still more caveates in latest version of Paper:
Also not sure if this PR meets all requirements/code style, but I tried to do my best.