Posted May 17, 20214 yr In 1.12, it was easy to have things occur on a block at regular intervals without a block entity: just schedule a block tick, override the block's tick method, and everything worked. I'm trying that now in 1.16.5 and getting nowhere. I have this in my block's class: @Override public void setPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity player, ItemStack stack) { super.setPlacedBy(world, pos, state, player, stack); System.out.println("Placed block!"); world.getChunk(pos).getBlockTicks().scheduleTick(pos, this, 1); if (world.getChunk(pos).getBlockTicks().hasScheduledTick(pos, this)) { System.out.println("SCHEDULED TICK"); } else { System.out.println("DID NOT SCHEDULE TICK"); } } It always logs "DID NOT SCHEDULE TICK". I continued testing by implementing the block's tick method, which I saw is now deprecated, to log stuff, and it's never called. Since it's deprecated, it looks like I'm meant to somehow handle block ticks through the block state's tick method, but I'm not sure how to do that since block states go through layers of builders and abstraction. I tried just creating my own class that extends BlockState, except it implements the tick method, and then copying the Block class's constructor's code for registering state except using my custom class, and that also failed to get any results. How am I meant to schedule and handle block ticks in the new version of Forge? I can't even seem to find any documentation on the changes online anywhere. Edited May 17, 20214 yr by IceMetalPunk Solved Whatever Minecraft needs, it is most likely not yet another tool tier.
May 17, 20214 yr Author 43 minutes ago, diesieben07 said: Do not use the Chunk's tick list. Use ServerWorld#getBlockTicks to schedule ticks. Mojang uses deprecations in the block class usually to mean "do not call this", overriding th emethod is fine. 🤦♂️ It would be a misunderstanding like that... Thank you, it works perfectly now! You're becoming quite invaluable to my return to modding, and I fully appreciate all your help! Whatever Minecraft needs, it is most likely not yet another tool tier.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.