ContentTweaker
ContentTweaker copied to clipboard
onUpdateTick function doesn't work unless the block has gravity.
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.
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.
I know it. I placed a block near the block to give block change.
This appears to apply to onRandomTick as well.
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
Oh huh. Yeah, it seems to be working now.
To anyone reading this thread later, I'm referring to onRandomTick. onUpdateTick still doesn't work correctly.
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?