Jump to content

NBT Problem [1.7]


TwIxToR_TiTaN

Recommended Posts

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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.