Fixed Waterlogging

Fixed Waterlogging

31.5k Downloads

Migrate to using Statement library

Micalobia opened this issue ยท 11 comments

commented

You're adding blockstates without Statement, which is generally unsafe and can cause crashes in datapacks that add structures using blocks you've changed, as well as the every block turning into a different block mentioned in #4

It's not terrible to add blockstates, if you need somewhere to look you can look at my mod Full Slabs. I used to not use Statement and it ended up biting me later, it makes life simpler.

commented

Hey there, would you be able to review 8cc6fe3 so I'm not doing anything wrong and messing up everything

commented

I was just about to suggest using statement as well ๐Ÿ˜†

I see a potential reason your onInitialize method wasn't initializing states properly:

here your injectBlockProperty call doesn't need to be inside and event, in fact it may cause issues to delay it until the event fires. You can just call StateRefresher.INSTANCE.addBlockProperty for each class you're adding waterlogging to.

I don't think you'll have to call StateRefresher.INSTANCE.addBlockProperty in any mixins if the above fixes your initializer.

One other thing I noticed:
here it looks like you could use a simple instanceof check rather than reflection.

commented

put full log on a paste site?

commented

I changed everything as you said and it seems to work fine now.
But When I first loaded the world I was previously testing in it seemed like all the old blocks that didn't have the waterlogged property until now had it on true.
Newly generated blocks weren't affected tho.
Any ideas on that @supersaiyansubtlety?

commented

So you think it's alright as it is now?

commented

Yeah if you make changes to blockstates, especially removing properties (which is effectively what happens when you change the properties you add: remove one and add another), blocks already in-world with the old states can become unexpected states or even other blocks.

I wouldn't worry about it, just let users know they may have to re-place/re-waterlog any affected blocks in-world.

commented

I haven't downloaded and tested, but it looks right; and based on your description I don't think there's a problem.

commented

I love it, can't start the game outside the dev enviroment and the logs giving no information why

commented

Just linking bug report to my mod where current FixedWaterlogging is crashing my mod's block that extends VineBlock: TelepathicGrunt/Bumblezone-Quilt#42

I'll look into trying to move away from using vine block (i was using to to reduce code duplication). But I want to see if you moving to Statement would fix the issue automatically as then I won't need to do a workaround to avoid your mod's mixins from breaking my blocks.

I love it, can't start the game outside the dev enviroment and the logs giving no information why

Try sharing your latest.log file after unable to start the game. Maybe there's info there about the issue

commented

you can just try it yourself by downloading the last build https://github.com/KxmischesDomi/FixedWaterlogging/actions/runs/1655433912

commented

looks like it is working for me. No crash and can start game
image