Posted November 12, 201410 yr Heyhey! Sorry if this is an obvious question, but I've done a lot of searching and haven't found anything specifically about this. I'm attempting to create a block (torch) that removes itself after a set amount of time. I'm trying to do it with a block instead of a tile entity for performance reasons (but feel free to let me know if I'm just doing it wrong) The whole world.scheduleBlockUpdate seems like the perfect solution, except this example use case: 1) place a torch that will expire in 1 hour 2) in 59 minutues, break the torch 3) place a new torch, hoping you've just bought yourself another hour of light 4) torch goes out in 1 minute, because the scheduled update from the first torch fires on the second one, as it has the same blockID, and it destroys itself. intuitively, I'd like to just remove any scheduled updates for the coordinates of the block when I place a torch, but that doesn't seem possible. Is it possible? Am I crazy?
November 12, 201410 yr I have not seen any way to "unschedule" an update tick. You might be better off scheduling a 5 minute update tick and using metadata (so after 5 minutes, you increment by 1, if it's now 16, break the torch, if not schedule another update). At worst someone will lose 4 minutes and 59 seconds worth of torch by popping it off the wall and replacing it. 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.
November 12, 201410 yr Author Yeah, except torches already use metadata values 0-4 to record their placement orientation relative to the walls around them (placed on north, east, west, south walls and floor, not necessarily in that order) which doesn't leave much room for anything else
November 12, 201410 yr Yeah, except torches already use metadata values 0-4 to record their placement orientation relative to the walls around them (placed on north, east, west, south walls and floor, not necessarily in that order) which doesn't leave much room for anything else Derp, you're right. Stupid metadata. :V Would still leave you 11 values to work with; about 5 and a half minutes per. You'd just have to make sure that mucking around with those higher bits doesn't do odd things to its placement (use bitwise operators). You can use reflection to access pendingTickListEntriesHashSet and pendingTickListEntriesTreeSet in WorldServer. If you remove a TickListEntry from both, it is canceled. Or you can reflect the sh*t out of things. Fair warning: if you're not familiar with reflection, this method is likely going to take you a very long time to implement correctly. Reflection is the library that lets Javacode modify itself, so it gets complicated and weird quickly. 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.
November 12, 201410 yr Author REFLECTION HIGH SCHOOL FOOTBALL RULES! (I love reflection) I'm going to give this a shot tonight! Thanks!
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.