onUpdateTick function doesn't work unless the block has gravity.
friendlyhj opened this issue ยท 6 comments
My script
val colliderOne as Block = VanillaFactory.createBlock("collider_lv1", <blockmaterial:iron>);
colliderOne.setToolClass("pickaxe");
colliderOne.setToolLevel(0);
// colliderOne.gravity = true;
colliderOne.onUpdateTick = function(world, blockPos, blockState) {
print("Update!");
};
colliderOne.register();
I gave the block a block update, but nothing happened in crafttweaker.log. But if I set gravity
property true, it will work.
Can confirm onUpdateTick is still broken, unless the block has gravity as stated before.
[1.12.2]
Edit: It looks like this is deliberate, and not a bug:
https://github.com/CraftTweaker/ContentTweaker/blob/develop/1.12/src/main/java/com/teamacronymcoders/contenttweaker/modules/vanilla/blocks/BlockContent.java#L193
In other words, onUpdateTick deliberately does nothing if the block has no gravity.
The question is, why was this done?
by that i konw, block update call when
-its change(mine it, open it(like chest) )
-its neer is change(mine side block, piston is neer push or pull)
-its other update fuct(redstone, has random tick(work like plant), gravity fall check. )
not call with every tick update.
onRandomTick works fine, according to my usage: https://github.com/Rebirth-of-the-Night/Rebirth-Of-The-Night/blob/master/src/common/scripts/contentweaker/scaffolding.zs this block breaks on a random interval without needing gravity