TerraformersMC / Terraform

Base library for the Terraformers' mods
GNU Lesser General Public License v3.0
37 stars 16 forks source link

Update mixins and consolidate mixin code style. #80

Closed gniftygnome closed 11 months ago

gniftygnome commented 1 year ago

I've gone through all the mixins in Terraform API and tried to consolidate the style and modernize, particularly with an eye to mod compatibility. Programming being what it is, probably nobody will completely agree with my style; here's your chance to change it. :P

There are a couple of behavioral changes here also. For example, we have not synced the game event in FarmlandBlock.setToDirt() like vanilla does; now we will. PathBlock now relies on FarmlandBlock.setToDirt() (no longer overriding what vanilla does), consolidating the block conversion and entity handling into a single code pathway which relies on the expansion of TerraformDirtRegistry.getFromWorld() behavior. The Redirect of map.get() in MixinBoatEntityRenderer has been changed to a WrapOperation, which improves compatibility but does mean we will execute vanilla code we did not execute previously.

I discovered our Farmland blocks don't support gourd growth while researching #22 and I have fixed this with a mixin to StemBlock. While checking other uses of Blocks.FARMLAND I noticed we have a lot of mixins to different instances of BlockState.isOf(Blocks.FARMLAND) and there is little consistency in how they are implemented. a7d4e81 makes all these implementations alike.

gniftygnome commented 11 months ago

Pushed to 1.20.3 (9.0.0) branch, since we are going to have to have a separate branch for it anyway.