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

So here is a question. I have an item and I want the item to do different things based on its NBT data (if this is the best way to do it). I want the player to be able to change that NBT Data with a keypress. So the default item when you create it/craft it sets up an NBT field and sets it to like 1 and when you right click puts resistance on you becasue that field is one. This will make it very simple to just use a switch to determine which ability to cast since the NBT will be an int field.  

 

The player then can press the "M" key or whatever and change the item being held's NBT data field to like 2 and this will make it so when you right click the item it will cast Fire Resistance or something to that effect. So is this method the best way to do this? Or is their a better way to do it? Plus I'm imagining packets would need to be involved so that the game knows "When player presses <KEYBIND> change the NBT Data" right? 

You need to use packets. The server doesn't know dick about keybinds and the client's NBT data gets overwitten by the server's copy.

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.

  • Author

Got it and applied it. Seems to work fine on both a server test environment and regular singleplayer environment. Found it easier to have a keybind press pass the player and their hand to a function that alters the NBT data of the item the player is holding

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.