ValkyrienSkies / Eureka

Basically Archimedes Ships, but with VS2 as the backend
Apache License 2.0
54 stars 32 forks source link

Ballon blocks broken by explosion do not impact ship flotation. #308

Closed lellasone closed 3 months ago

lellasone commented 4 months ago

This issue occurs when only Valkyrien Skies and addons are installed and no other mods

Minecraft Version

1.20​

Mod Loader

Forge

Issue description

Expected Behavior: Airship balloons cease to operate when destroyed. This means that as balloons are damaged onboard a ship it will lose lift and fall out of the sky.

Observed Behavior: Airship balloons broken by hand behave as expected, but balloons broken by fire or explosion continue to operate even once gone.

I have tested this in a clean install with only VS and Eureka installed.

The two "ships" prior to any damage. 2024-02-19_11 32 04

The two "ships" after damaging the left ship by hand and the right ship with TnT. 2024-02-19_11 33 12

Issue reproduction

How to reproduce:

Expected Result: Both ships sink to the ground. Actual Result: The hand-broken ship sinks to the ground, but the tnt ship continues to fly as if the balloons still existed.

Logs

latest.log

lellasone commented 4 months ago

Okay, after a bit more poking around the issue seems to be that fire and tnt don't actually call "destroy". Instead, they replace the damaged block with air directly (or at least fire does). Forge does however have "onBlockExploded" and "onCaughtFire".

Assuming those work the way I'd expect, adding balloon decrement code to both should make ships behave intuitively in 90% of damage cases. It would introduce a multi-count bug during fires, but I expect the result to feel pretty intuitive in actual game play.

I don't have a dev environment for modding, but if/when I get one set up I'll do some experimenting and report back.

chocbic172 commented 3 months ago

@lellasone Thanks for the helpful information and well documented reproduction steps.

316 has been created with a fix for this issue, as well as similar issues that could occur for Floaters, Anchors and Helms.

Turns out the destroy method only applied when a player broke the block, as you figured out. Replacing this method with onRemove fixed the issue, as this seems to be called whenever a block is destroyed.