Skip to content

Add Cause tracking for SulfurCube - #2295

Open
Firemoon777 wants to merge 1 commit into
EngineHub:version/7.0.xfrom
Firemoon777:version/7.0.x
Open

Add Cause tracking for SulfurCube#2295
Firemoon777 wants to merge 1 commit into
EngineHub:version/7.0.xfrom
Firemoon777:version/7.0.x

Conversation

@Firemoon777

Copy link
Copy Markdown

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: DENY flag, 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 tnt is not set to DENY.

But there are still more caveates in latest version of Paper:

  • WorldGuard prevents stealing cube with bucket, but sulfur cube will disappear. It's only client-side, bug reported: Sulfur Cube bucketing ignores cancellation PlayerInteractAtEntityEvent PaperMC/Paper#14113
  • Player still can spawn cube within protected region if player aims into another entity and pointing "through" entity on near block. According to logs every interaction event is cancelled, but cube still spawns. Not sure if it a WorldGuard issue.
  • Cube's explosion can trigger nearby explosive sulfur cubes. Damage events are cancelled by WorldGuard as well, but cubes somehow don't care. Not sure if it a WorldGuard issue again

Also not sure if this PR meets all requirements/code style, but I tried to do my best.

@me4502

me4502 commented Jul 28, 2026

Copy link
Copy Markdown
Member

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:

  • Is this adding usage of any Paper-specific APIs? (eg, will this break Spigot compatibility)
  • Are there any non-TNT ways to make a sulfur cube explode? Just noticed a lot of the checks are basically just treating an explosion as TNT if a sulfur cube explodes, so just double checking that it's a safe/correct assumption

@Firemoon777

Copy link
Copy Markdown
Author

Is this adding usage of any Paper-specific APIs? (eg, will this break Spigot compatibility)

No, I guess no Paper-specific APIs were used. SulfurCube Entity exists in Spigot and I used none of its inherited interfaces, just checking with instanceof.

Are there any non-TNT ways to make a sulfur cube explode?

As for now, and according to Minecraft Wiki, explosive archetype is achieved by consuming items with tag #minecraft:sulfur_cube_archetype/explosive. Again, according to Minecraft Wiki Item Tag page there is only one item with this tag — minecraft:tnt.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interaction with sulfur cubes are not covered by WorldGuard

2 participants