mim1q / ConvenientDecor

Apache License 2.0
2 stars 5 forks source link

Crashes when farmlands turn to dirt on placement #6

Closed Linguardium closed 1 year ago

Linguardium commented 1 year ago

https://discord.com/channels/570630340075454474/1131387906284593262/1131387906284593262

Linguardium commented 1 year ago

the common occurance I have seen on the AOF server is when a farmland block replaces another or is placed above another

Linguardium commented 1 year ago

looks like the issue is here:

https://github.com/mim1q/ConvenientDecor/blob/829e5a4c60a76659280f6a62e74c7979c2c56c4b/src/main/java/com/github/mim1q/convenientdecor/mixin/block/FarmlandBlockMixin.java#L54C5-L54C5

you check if the farmland block has the proper property, but you mixin to all returns. when the original method returns DIRT.getDefaultState(), you are checking if farmland block has the property, not the returned state. you then later attempt to apply the property to the original state. you should instead check if the originally returned state is unhydratable.

I would also suggest that you dont blindly overwrite the moisture state. I would suggest you check if your values should be modified, and if so return the modified state, otherwise dont modify it. default state should cover all unmodified states.

mim1q commented 1 year ago

Sorry for not responding - this should be fixed in the latest update: https://modrinth.com/mod/convenient-decor/version/0.2.0 I have to overwrite the moisture state because the crop growth is affected by that, and I feel like doing that is a bit less invasive than mixin into crops and modifying their growth behavior (might be wrong, but it only caused weird issues when I tried that 😭)

Let me know if it's still broken, maybe with some modded farmland types or something 👍 I'll reopen the issue if you do find anything 😁