Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mixins and consolidate mixin code style. #80

Closed
wants to merge 2 commits into from

Conversation

gniftygnome
Copy link
Contributor

@gniftygnome gniftygnome commented Sep 25, 2023

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.

  • Deprecate 2-arg DirtPathBlock constructor in favor of new one-arg (like FarmlandBlock)
  • TerraformDirtRegistry.getFromWorld now finds any DirtBlocks variant (added farmland and path)
  • Follow vanilla changes in MixinFarmlandBlock
  • Consolidate mixin code style (likely to spur some debate)
  • Update to WrapOperation: MixinAnimalEntity.spawnOnCustomGrass, MixinSugarCaneBlock.canPlaceOnSoil, MixinBoatEntityRenderer.getBoatTextureAndModel

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.

  • Allow gourds to grow onto our Farmland blocks
  • Allow pitcher plants to be planted on our Farmland blocks
  • Refactor Farmland mixins a bit more to be consistent

- Deprecate 2-arg DirtPathBlock constructor in favor of new one-arg (like FarmlandBlock)
- TerraformDirtRegistry.getFromWorld now finds any DirtBlocks variant (added farmland and path)
* Follow vanilla changes in MixinFarmlandBlock
* Consolidate mixin code style (likely to spur some debate)
* Update to WrapOperation: MixinAnimalEntity.spawnOnCustomGrass, MixinSugarCaneBlock.canPlaceOnSoil, MixinBoatEntityRenderer.getBoatTextureAndModel
@gniftygnome gniftygnome added enhancement New feature or request compatibility Mod compatibility issues labels Sep 25, 2023


- Allow gourds to grow onto our Farmland blocks
- Refactor Farmland mixins a bit more to be consistent
@gniftygnome
Copy link
Contributor Author

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

@gniftygnome gniftygnome closed this Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Mod compatibility issues enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants