Skyblock Builder

Skyblock Builder

6M Downloads

captureBlockSnapshots cause problem

joe-vettek opened this issue ยท 13 comments

commented

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.
image
image
image

commented

((LevelTicks<Block>)level.getBlockTicks()).removeContainer(new ChunkPos(pos));
I thought I had to use AT to change it, but it seems that there is no need to change it, the default is public.
You can addContainer after you place the template.

Have test it here.
image

commented

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.

commented

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.

commented

Oh wait, that would also remove the scheduled tick from your block...

commented

But having said that, I think this feature should probably be allowed to be set by users?

commented

Sounds like a good idea.

commented

I also use structuretemplate.placeInWorld to place the template and it works always well without using this.level.captureBlockSnapshots = true;.

commented

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.

commented

it's really a worldgen problem, i have ever seen the scene in desert biomes. The block don't fall until neighbor changes. if there are not tick counter and then level.scheduleTick would not work.
image

commented

you can frozen it if you're placing a template.

commented

What exactly do you mean?

commented

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.

commented

For example, i use the removeContainer(new ChunkPos(-2,-2)) in debugger at here.
image
Now the sand floating in the air.
image
image