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 have a problem using NBT data.

It saves the integer correctly but when i restart the client or when i create a new world it keeps the value and it doesnt reset it. Can some one have a look at my code?

Thanks!

 

http://pastebin.com/i2z9Cvw3

Only code when your having fun doing it.

I'm sorry, but... * facepalms *

 

GO ACTUALLY LOOK UP WHAT A STATIC VARIABLE IS IN GOOGLE!!!!

 

>.>

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Static can refer to non-static code by slapping an instance in front of the non-static code.

Just saying if that helped.

Developer of the WIP Rubies mod.

I have a problem using NBT data.

It saves the integer correctly but when i restart the client or when i create a new world it keeps the value and it doesnt reset it. Can some one have a look at my code?

Thanks!

 

http://pastebin.com/i2z9Cvw3

Hi

 

I don't really understand what you are asking.  Could you describe it in a bit more detail (be specific)?

1) what you expect to happen

2) what actually happens

A bit of background on what you're trying to do (what mod feature this is) would also help.

I suspect that static doesn't have anything to do with your problem, but then I'm not actually sure what you are trying to do.

 

-TGG

 

I suspect that static doesn't have anything to do with your problem
Look at his code. Yes, it does.

@dieSieben

I agree the static is a potential problem if he or she wants each player to have their own XP, but I don't think it's causing the problem he or she is describing. The problem looks to me like he is mixing up an EventHandler with IExtendedEntityProperties.  The implements IExtendedEntityProperties looks like a red herring because if it had been used as a normal IExtendedEntityProperties, the symptoms should be different (i.e. all entities have the same XP level, not that the XP level is persistent after restart). 

 

@TwIxToR_TiTaN

Anyway because I'm not sure what you are trying to do, I don't know the best way to suggest to fix it.  There are several potential problems with how you're implementing this and once you give more info we can help you work them out.

 

-TGG

IT'S A MESS!

1) Using getEntityData along with Extended properties and mixing them up.

2) creating new properties for each entity, but sharing the variables between them all (class static variables).

3) static method setLevel uses partly argument (level) and then makes invalid access to static variable for currentLevel.

4) The following code is useless and gets nobody's armor:

public static int getArmor() {
      EntityPlayer player = Minecraft.getMinecraft().thePlayer;
      return armor; <<<--- STATIC VALUE
}

5...n) Any number of other problems I didn't check closely enough on.

 

 

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.