Jump to content

Recommended Posts

Posted

I've been trying to figure this out for awhile now. I have a block with an updateTick() and setTickRandomly() on true. https://pastebin.com/u1zz4LZT However, the ticks are incredibly slow, sometimes minutes apart. I found reference to a similar issue in a really old thread elsewhere, but no answer. I have tried playing with tickRate() with no effect, and also randomTick(). I tried doing something with scheduleBlockUpdate() by forcing a tick with onBlockAdded() then again in the updateTick() (massively bad idea?), and it sort of worked but led to strange and unintended behavior. Note: It does not need to be the full tick speed, just fast enough to not be noticeable in-game.

 

Strangely, it works fine for anything extending blockBush. Does it have to be a plant to work correctly? (I would think not)

Posted

Blocks do not update every tick. That's not how that function works. 

 

tickRate() does fuckall unless you call it yourself. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)

In general I'm not sure I'd suggest using those methods for something you want to happen "every tick".  There are several different forge handles that fire on tick events, but I think the one you'd be most interested in is TickEvent.WorldTickEvent (this is the tick that usually happens 20 times per second for each given dimension, and is shown if you run the in-game command "/forge tps")

 

The other tick events can also be found in the same class (TickEvent).

 

Any chance you could tell us what it is you're trying to do every tick?  Better make sure it's not too expensive or you'll break the game pretty fast.

 

Edit 1 ===============

If you decide to subscribe your block itself to the world tick event, make sure you have it check the event to see what world it is for, or else each block will be using the event once for each loaded dimension.

Edited by Laike_Endaril
Posted
3 hours ago, Laike_Endaril said:

In general I'm not sure I'd suggest using those methods for something you want to happen "every tick".  There are several different forge handles that fire on tick events, but I think the one you'd be most interested in is TickEvent.WorldTickEvent (this is the tick that usually happens 20 times per second for each given dimension, and is shown if you run the in-game command "/forge tps")

 

The other tick events can also be found in the same class (TickEvent).

 

Any chance you could tell us what it is you're trying to do every tick?  Better make sure it's not too expensive or you'll break the game pretty fast.

 

Edit 1 ===============

If you decide to subscribe your block itself to the world tick event, make sure you have it check the event to see what world it is for, or else each block will be using the event once for each loaded dimension.

This is pretty much the entire purpose of tile entities

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)

The problem is tileEntities would probably cause way too much lag for the purpose (which is why I'm avoiding them). It only needs to spawn and despawn that block above it based on conditions, nothing more or less. And there will be alot of these blocks, they are naturally generating.

 

It also does not need to update every tick, just a few times per second. But why can plants do that (breaking when not on a solid block is an updateTick), but my block can't?

Edited by Cyberdragon
Posted
19 minutes ago, Cyberdragon said:

breaking when not on a solid block is an updateTick

Plants check whether they can stay or not when their neighbour changes, not when the block receives the update tick. Actually a lot of blocks work like that - crops, torches, end rods, flowers, fire, snow layers, cactus, chorus plants, tallgrass, mushrooms, sugar cane, vines, ladders, pots... I could go on but you hopefully get my point. All these blocks don't update(most of them don't even allow the world to "tick" them) but rather detect neighbours changing and re-evaluate themselves. See any of those block's classes to see how they do that. I would recommend BlockLadder since it is probably the least complex of them all.

 

If that doesn't work for you then you might need to use forge's WorldTickEvent to manually run whatever logic you need. There is really no way to make the block "tick" every X ticks without either using a TE(which you want to avoid) or scheduling block updates(which is just as slow as TEs are pretty much but has additional issues that can easily crash your world, especially if there are a lot of them scheduled, I've personally experienced the "ticknexttick list out of sync" issue as an example)

Posted
9 hours ago, Cyberdragon said:

As I said, I have tried scheduled ticks and it does sort of work but yeah, it glitches. I'll try an eventbus with tick events then and see what happens.

Please don't, either make a TileEntity or use net.minecraft.block.Block#onNeighborChange

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.