Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Is there any way to make an item cooldown, ex. (after using my wand I have to wait a second before I use it again.)

 

thank you for your time:

~BoonieQuafter-CrAfTeR

Im serious don't look at it!!

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.

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.

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

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]

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.