Closed joe-vettek closed 6 months ago
meanwhile, i'm not sure if i can afford a present for other players by built-in method
In my opinion, your block should be a ticking block entity. That way, you can easily save all the data and don't need the OneBlockSave
. That would also solve your problem here. You could check for initialized
. If not done, this can be done and saved in the block.
And I don't understand why your block is ticking randomly, you don't use randomTick
method. It's just calling the super method, which is calling the tick
method. And isTickingRandomly
should be set using BlockBehaviour.Properties
.
If you implement this block as block entity and this issue still exists, please open a new issue.
PS: Your block can't be removed completely from the world, not even with setblock
command.
Thank you for testing what i said even i don't want you to do so much. I should chat with you in discord. In fact some of code in my class was just left for debugging. So i should introduce my mod to you first.
The logic of the mod is we prepare a block and use Sky Builder to load the NBT. And then once the block was placed, it would remove itself and save the pos in WorldSave. Then played can dig the pos and the mod place new block at the pos. So if you want to remove a pos, you can only delete the data file or use the command /oneblock remove ~ ~ ~
.
So there is no randomTick indeed. But my block can't receive a onplace to schedule a tick activity and then a randomTick to trigger the tick event. randomTick here just in case.
What I not understood was that Sky Builder don't trigger the onplace method. Even the command /onplace template
would trigger the onplace method.
Describe your idea
I'm writing a mod which aims to add a infinite block in the world, yes it load with a minecraft nbt file. But not trigger onPlace funcition.
Here is my mod