Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] Item cooldowns?


BoonieQuafter-CrAfTeR
 Share

Recommended Posts

The most common are NBT and damage values. Upon using your wand set it to 0 damage, then wit the onUpdate method increase the damage value by 1. The damage bar would be an indicator to the time. When the damage is maxed, the tool is ready again. If you must use the damage for something else, then you can store an integer in the NBT of the item stack.

Link to comment
Share on other sites

For per-item effect - indeed - store coolown in NBT and decrement it every tick.

Only problem with this design that cooldown will pass only when item is in player's inventory (and maybe some other situation).

 

If per-player - use IEED to store cooldown for item.

+ of this design is that cooldown is for all items of same type for given player and is always passing (even if you don't have item). It also removes NBT usage and overally is better in most cases.

 

For wands (skills/spells) I recommend IEEP, depends on design really.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

I am using a very cheaty method I think

 

 


public long thingStuffyHandler;
public boolean allowInteract;

public method methody(parameter, parameter2){

//on activated
if(allowInteract){
doStuff();
thingStuffyHAndler = System.currentTimeMillis();
allowInteract = false;
}
//Update
if(System.currenTimeMillis() - 1000 > thingStuffyHandler){
allowInteract = true;
}

}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Link to comment
Share on other sites

Hi, I suggest a much more better way, using NBT of course. In the stack's NBT, set a long containing the getTotalWorldTime() and add the time in ticks you want in cooldown. Then, check if the total world time is greater than the long you just saved - If I is, the cooldown has passed. Set the long again whenever you need to - this way, you don't have to use any onUpdate method / ticker. The reason why we use the total world time instead of the current world time is because the current world is dynamic, meanin it can change when setting the time to day / night, ruining / breaking the cooldown completely.

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

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.