terrarium-earth / Ad-Astra

Ad Astra is a Minecraft space tech and exploration mod!
https://modrinth.com/mod/ad-astra
Other
145 stars 81 forks source link

[Bug]: Interactable blocks are unusable in no-oxygen environments when holding things that die #534

Open Linguardium opened 6 months ago

Linguardium commented 6 months ago

Bug Description

https://github.com/terrarium-earth/Ad-Astra/blame/9d1b4a9b81b870bd4dc3faa2e3968f040a190a62/fabric/src/main/java/earth/terrarium/adastra/fabric/AdAstraFabric.java#L37-L43

Hard failing here causes interactions with blocks to fail depending on whats in your hand. for example, opening chests no longer works.

How to Reproduce?

go to a planet without oxygen hold plant or other things that die in non-oxygen environments try to open chest

Expected Behavior

chest opens, but plant cannot be planted

Version

1.20.x (linked to source above)

Mod Loader Version

N/A

Mod Loader

Fabric

Logs or additional context

https://github.com/terrarium-earth/Ad-Astra/blame/9d1b4a9b81b870bd4dc3faa2e3968f040a190a62/fabric/src/main/java/earth/terrarium/adastra/fabric/AdAstraFabric.java#L37-L43

extra link just in case

Code of Conduct

ThatGravyBoat commented 6 months ago

This is because fabric does not have a block place event and trying to mixin will cause more compatibility issues than replacing this will solve, I will leave this open as a reminder to keep checking if fabric adds a block place event

Linguardium commented 6 months ago

I am not sure how it will cause more problems than it will solve, A mixin into ItemPlacementContext to add an oxygen check for the blockstate should handle every BlockItem placed by players, by default. additionally, adding it to AutomaticItemPlacementContext covers blocks placed by dispensers as well as Spectrum block placers too.

Sure, custom mod BlockItems that bypass all of vanilla's logic and force set blockstate may still work, but I feel like that issue is significantly more niche