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

Heeeyy! I need to trigger something everytime you move (drag and drop) an Item inside your Inventory :L

Can someone help me? Is there an event like that?

 

Or maybe if that's not possible an event that triggers when you put an item inside a crafting grid (2x2 / 3x3) ? :L

Edited by Heeee

  • Author
Just now, diesieben07 said:

There isn't.

What are you trying to achieve (from the player's perspective, not how you intend to program it)?

I saw an thread about removing item repair. So I thought because the nbt tags keep on reseting for me,

it would be possible to update the nbt tags everytime you put such an item inside a crafting grid :L

  • Author
Just now, diesieben07 said:

If your NBT tags "keep resetting" then you are doing something wrong. Don't try to hack around the problem, fix the problem.

 

Post your code.

public void PlayerInteractEvent(PlayerInteractEvent event)
{
    if ((event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) || (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR))
    {
        if (event.entityPlayer.getHeldItem().getItem() instanceof ItemTool)
        {
            if (event.entityPlayer.getHeldItem().getItem().isRepairable())
            {
                event.entityPlayer.getHeldItem().getItem().setNoRepair();
            }
        }
    }
}

 

It works fine, but everytime I restart my game (restart not leaving the world and rejoining) it keeps reseting :L

  • Author
Just now, diesieben07 said:

You seem to be using a very outdated version of Forge. The version of PlayerInteractEvent you are using was last used with 1.8.x. Please update to a more modern version of Minecraft as a first step.

Oh damn it! Posted an old copy of the code, I already updated. Sorry 'bout that.

Anyway the part with the " event.entityPlayer.getHeldItem().getItem().setNoRepair();" is the same :L

  • Author
Just now, diesieben07 said:
  • setNoRepair has nothing to do with NBT.
  • setNoRepair is an per-item flag, which is supposed to be set at startup. You cannot dynamically set it.

Ohh I see... But what's the nbt tag called, so I can look it up?

  • Author
1 minute ago, diesieben07 said:

Which NBT tag are you talking about?

One to remove the possibility to remove item repair :L

Like the setNoRepair, just permanetly.

Is there even anything like that?

  • Author
6 minutes ago, diesieben07 said:

setNoRepair is permanent, per Item. You should call it in preInit if you want to do it for items that are not yours.

With "GameRegistry.findItem..." and then adding setNoRepair to all of the tools? Or would I go about that?

  • Author
5 minutes ago, diesieben07 said:

findItem is once again from an old version of Forge. Please update.

Use ForgeRegistries.ITEMS to interact with the item registry.

That was something I copied from another (apparently old) thread.

But I managed to it in preInit! So thanks for helping c:

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.