MatrexsVigil / phc2crops

All rights reserved - None of my artwork is available to be used for FREE in your game EVER. If you want to HIRE ME, please contact me. Thank you. This code is here for people to learn from and to help find bugs ONLY.
https://www.patreon.com/pamsmods
Other
16 stars 23 forks source link

1.18.2 merge #60

Closed cwdogflip closed 2 years ago

cwdogflip commented 2 years ago

Updating for Minecraft 1.18.2. The PR looks a bit gnarly since I did the work based on 1.16.3 and then later rebased back to this (it made sense at the time, I swear) and the first commit basically sets this branch's src contents to 1.16.3 so I could do that. There might be a bit of unintended weirdness as a result, but I didn't notice anything obvious when testing things. It might be easier to look at the changes on a commit by commit basis, but your mileage may vary.

Beyond the initial repaving, there are four major changes:

  1. Updating the package and member names to account for differences between versions and mapping types (Forge only supports the official Mojang mappings now).
  2. Getting the custom blocks and items switched to using the DeferredRegister model of registration (this appears to be required in 1.18.2 for blocks but not items. That being said, there may be a less obvious runtime requirement for items to switch than there was for blocks and it looks like this would be required for 1.19 anyway so I just went ahead and did it).
  3. Changing the fern, grass, and tall_grass loot tables to using Forge’s Global Loot Modifier system. Trying to do it the old way would end up potentially overwriting any other loot table changes other mods make, but using the GLM system will simply add onto them. This involved replacing the three separate *LootHandler classes with a new class (PamLootHandler) containing a serializer that reads in the (slightly modified) fern/grass/tall_grass loot tables, calculates what drop to add based on item weights (there may be a way to do this automatically, but I don’t know how and couldn’t find anything about it either in the Forge documentation or elsewhere) and then applies the functions to the dropped items.
  4. Reworking how the gardens were added to worldgen. This area has changed quite a bit since 1.16.3 (and it looks to have changed quite a bit again for 1.19…) so there’s a chance the spawns might not work exactly 100% the same way as they used to, but I haven’t been able to see a clear difference in behavior.

How verified: I tried out every feature I could think of. I flew around different biomes in creative to see the gardens spawn, I broke them open in survival with and without fortune to test the loot modifier function, I tried some of the recipes, and I planted seeds, crops, and default wheat and harvested them with right click. I started up a standalone server on my computer with the mod and connected to it, without any observable issues. I may have missed an edge case or two, but for the most part everything seems fine.