Jump to content

Recommended Posts

Posted

Hi

Is there a method in the block class that is called every tick that includes a BlockPos instance and World instance? Or maybe there's an event that includes these parameters? Thanks in advance. (BTW the updateTick method in the block class is not being called [yes my parameters are definately correct])

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Posted

Why would I create a tile entity for a simple block? Seems like there is an easier way to get a ticker with these needed instances. Thanks for the reply, though. If I need to resort to TE's I will.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Posted

Well, the way I see it, if it need to be ticking it is straying from being a simple block. And I don't think there is such a method anyway. But if you need it for anything particle or rendering related by any chance there's always onRandomDisplayTick (I think that's what it's called) but that is in 1.7 and I don't know if it's still in 1.8.

Posted

Hey! Turns out I was wrong (happens sometimes). There is such a method:

updateTick(World world, int x, int y, int z, Random random)

Guess it pays to do research. Now, as for it not getting called, I found this in the JavaDocs:

Ticks the block if it's been scheduled

So you will have to schedule it.

 

It turns out research payed off again. :) After looking at how crops work I found this line of code to do that:

this.setTickRandomly(true);

 

Hope this helps.

Posted

Oh sorry, after writing that I realized you are in 1.8 and I'm in 1.7. That method might involve BlockPos instead.

Posted

Hey thanks for the replies! I was looking as well and now I realize that it kind of makes sense to make this a tile entity, but I'm just trying to find out a simpler way. I've looked in the pressure plate class and pressure plate base class and they do the exact same thing oddly enough with the random tick and update tick method. I really do appreciate your help!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Posted

TNT doesn't use ticking because Primed TNT is an entity. I looked at the code too. :)

Posted

Block's updateTick function does not run every tick. ......unless you schedule it to. Look at the repeater.

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

If you really need to receive tick updates more than just "quite rarely" you cannot get any more efficient than a TileEntity.

Thanks for the reply. I thought this as I was finishing some code last night when it was discussed at the beginning of the topic. I'll look into Tile Entities later on.

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

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.