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

I know it's rather simple, but I can't figure it out by myself.

I have item which players are supposed to right click and when that happens it sets the variable to for example x coordinate, and then on left click it shows that value, but if another player perform right click action that variable is set to his x coordinate, but I want that every player have their separate value.

This sounds a lot like a Java question, and it also sounds like you might be using the static keyword. Post some code, I'll take a look.

I know it's rather simple, but I can't figure it out by myself.

I have item which players are supposed to right click and when that happens it sets the variable to for example x coordinate, and then on left click it shows that value, but if another player perform right click action that variable is set to his x coordinate, but I want that every player have their separate value.

ย 

You have to store the information in the ItemStack's nbt tag, because the Item class is a singleton.ย  Every field is effectively static.

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.

Item (as class) has only one instance (or rather that many as you register into Game). The Item is a definition of what you are holding, the ItemStack is the thing that actually holds data. You cannot assign ANY data to Item that you don't want to be global. To save data per-item you need to use ItemStack's NBT.

ย 

You can do that straight from yourItem class. No point in explaining further.

ย 

www.minecraftforge.net/wiki/Creating_NBT_for_items

ย 

Post code if you can't figure out why it doesn't work. (note: NBT is null on default).

ย 

EDIT

Why am I not getting notifications that someone wrote before me? :C

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

  • Author

Thanks a lot, that works, but I don't really want that data to be accessible after player left the server.

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.