Posted June 1, 20169 yr How would I make a timer? For example I right click my sword using the onItemRightClick method it then gives me strength 3 for 5 seconds, now how would I make it so this effect won't activate again even when right clicked for 15 seconds?
June 1, 20169 yr Compare written world time to the currnet world time + delay amount. If greater: Do your effect and write the current world time to the ItemStack's NBT. Else: Do nothing 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.
June 2, 20169 yr Time is kept in ticks, 20 ticks to the second. If you can add a tick counter to your item stack or player entity, then you could count down 300 ticks before allowing the special ability again. See how other cool-downs are implemented. The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.
June 2, 20169 yr That causes updates to the itemstack every tick, which isn't efficient. 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.
June 2, 20169 yr Compare written world time to the currnet world time + delay amount. While I don't have anything against timestamps - you also need to secure NBT timestamp for multi-dimensions. That causes updates to the itemstack every tick, which isn't efficient. It is, if you use @Capability Said that - timestamp can often be better, but for short timers I prefere caps. 1.7.10 is no longer supported by forge, you are on your own.
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.