captureBlockSnapshots cause problem
joe-vettek opened this issue ยท 13 comments
Describe your idea
I didn't use debug mode before, so I didn't find the problem. I thought Skybuilder used some weird way to place the blocks. Finally, I found that the reason was the use of this.level.captureBlockSnapshots = true;
I don't know why you want to use this, which resulted in the block's onplace method not being called, which is an initialization method of the block state. I don't think this is a good call. Of course BlockEntity can solve it. It's just that I need to do some extra unnecessary coding work. The most important thing is to cause trouble.
I tried with calling this.level.getBlockTicks().clearArea(BoundingBox.fromCorners(center, center.offset(template.getTemplate().getSize())));
. This removes all the scheduled ticks for the template. Thank you very much for helping properly fixing this problem.
I resolved this issue locally. Will publish it as soon as my Jenkins is working again.
The way I write it is just to standardize it, and there is actually no need for scheduled. But it does need to be initialized, otherwise it will be full of uncertainty in many cases.
But having said that, I think this feature should probably be allowed to be set by users?
I also use structuretemplate.placeInWorld
to place the template and it works always well without using this.level.captureBlockSnapshots = true;.
Here is the reason for doing this: bfc8f27
If you have a better idea how I can achieve that gravel isn't falling, torches in mid air aren't droping, I'm really interested in this. Using it was never a problem since blocks were placed when creating the template -> onPlace is called -> BlockState is initialized.
the gravel fallen because the scheduleTick method of ServerLevel was called during onplace to register a timer to check whether it is floating. Just make it unregisterable.