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

Hello everyone.

I am working on a mod and I hit a little break, I need to make something that breaks a block slowly like a tool but when the person presses right click.

I think it's OP to make an item that breaks stuff every tick.

If anyone uses Thaumcraft, they should know about the wand of excavation or how it's called in the new versions, I haven't done mods in a while.

I would like to have something that works kinda like that, how could I do that?

Don't know exactly, but I believe that there is something like onBlockRightClick or something like that I believe?

Did I help? Gimme a thanks!

You could try to create some sort of cooldown before the block is harvested.

I'm always happy to help others!

 

Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL

I have the thaumcraft source and he use onItemUse and just break the block instant. And there is no cool down or something.

 

But you could make it like this that you add with itemNBT a custom cooldown.

 

like this: Note its a custom Function you only need to call it in the onItemUseFunction

public boolean onItemUseage(ItemStack stack, World world, int x, int y, int z) //More is
{
      if(stack.hasTagCompound())
      {
           NBTTagCompound nbt = stack.getTagCompound().getCompoundTag("tool");
           if(nbt.getInteger("coolDown") <= 0)
          {
                 //Here do your break code
                 nbt.setInteger("coolDown", 20);
                 return true;
          }
      }
      return false;
}

public void onUpdate(ItemStack stack, World par2, EntityPlayer player)
{
     if(stack.hasTagCompound())
     {
          NBTTagCompoun nbt = stack.getTagCompound().getCompoundTag("tool");
          if(nbt.getInteger("coolDown") > 0)
          {
                int between = nbt.getInteger("coolDown");
                nbt.setInteger("coolDown", between-1);
          }
     }
}

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.