Posted July 4, 201510 yr 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]
July 4, 201510 yr Author 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]
July 4, 201510 yr 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.
July 4, 201510 yr 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.
July 4, 201510 yr Oh sorry, after writing that I realized you are in 1.8 and I'm in 1.7. That method might involve BlockPos instead.
July 4, 201510 yr Author 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]
July 4, 201510 yr Author I'm guessing override updateTick and return true for setRandomTick in the block constructor. Trying it now! Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]
July 4, 201510 yr Author Still not working (going to look in the TNT block class cause I'm also using explosives). Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]
July 4, 201510 yr Author Haha right before you said that I was like "Aww tnt is an entity when primed ". I'm going to keep trying though! Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]
July 4, 201510 yr 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.
July 4, 201510 yr Author 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.