NBT Tag values hold their original real value while secretly resetting it to 0 for selective components.

Started by StellaeLux on Wed, 09/18/2019 - 14:26

Topic category: Bugs and solutions

Last seen on 20:25, 8. May 2020
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
NBT Tag values hold their original real value while secretly resetting it to 0 for selective components.
Thu, 12/26/2019 - 11:01 (edited)

What I'm about to describe is a situation that was so strange that it made me lose my sanity. What happened here is impossible...~

I Created a procedure that simply sets a value to 0 only upon joining a world for the first time:

------------------------------------------------------------------------------------

Event Trigger: Player joins the world

If not Get entity data logic NBT tag "JoinedBefore"

   Do Set entity data logic NBT tag "JoinedBefore" to true
   Do Set entity data number NBT tag "Counter" to zero

------------------------------------------------------------------------------------

So I created 2 Overlay elements with only a slight difference. They become visible after the counter hits 1 for the first overlay and when it hits 2 for the 2nd overlay:

------------------------------------------------------------------------------------

Condition true if: Get entity data number NBT tag "Counter" > 0
Condition true if: Get entity data number NBT tag "Counter" > 1

------------------------------------------------------------------------------------

I simply made food to be able to (test) increase the counter to test whether the Overlay elements become visible.

------------------------------------------------------------------------------------

On Food Eaten:

Set entity data number NBT tag "Counter" to Get entity data number NBT tag "Counter" + 1

------------------------------------------------------------------------------------

I even created an additional "print" for testing to be able to see the value for myself:

------------------------------------------------------------------------------------

On food right clicked

Send message to provided entity create text with "Counter: "

                                                  Get entity data number NBT tag "Counter"

Show in action bar: false

------------------------------------------------------------------------------------

So here I go starting up a new world. I right click and yup: Counter = 0. Neither overlay elements are visible. (As intended)

So I eat the food once and there you go! Now the counter is 1 and 1 overlay element is visible. (As intended) Eating food for the 2nd time makes the 2nd overlay element visible! (As intended)

So I close the world and reopen it, to find out that the NBT counter is still 2... as intended! But yet... the overlay elements have both gone missing and only appear upon increasing the NBT counter to 3 and for the second... 4...

The value is literally saved. Counter is visibly 2, yet in the overlay procedure it returns False for Get entity data number NBT tag "Counter" > 0...

Every time you close the world and reopen it, it treats Counter as if it is 0 in the Overlay system, yet when printing it's value, it is not...

How is this possible?

Edited by StellaeLux on Thu, 12/26/2019 - 11:01
Last seen on 20:25, 8. May 2020
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
Okey, I definitely found a…
Wed, 09/18/2019 - 15:22

Okey, I definitely found a bug of some sorts. I did some testing around:

I created a BLUE block that makes a dirt sound when placed ( through basic settings) and added this procedure:

------------------------------------------------------

When block is places by:

if Get entity ta number NBT tag "counter" > 0

Do place STONE at x y z

------------------------------------------------------

When loading the world up for the first time and placing this block (counter = 0), you'll place the BLUE block with a sand sound.

When increasing the counter to 1, the block will now spawn stone with the stone sound.

When reloading the world with counter = 1 you will still spawn the Stone block but THIS TIME with a sand sound! Only after you increase it to 2 will it start spawning with a stone sound!

 

The bug somehow resets an NBT tag back to 0. So if you have a condition where if x > 5. If you reopen the world with x being 7, you'll need to reach 12 because it somehow treats x as 0 instead of 7, while treating it as 7 for different parts of the program!

When it comes to placing the block, it works, but strangely for the sound aspect of it, it doesn't. And it also doesn't work in the Overlay procedures.

I hope that helped.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
If this delays the beautiful…
Wed, 09/18/2019 - 15:31

If this delays the beautiful update that is 1.9.1, I'm sorry xD

Overlays are client-side,…
Wed, 09/18/2019 - 16:46

Overlays are client-side, while events happen on both server and client-side. Related tickets and resolutions that will be published in 1.9.1:

Make sure that you are getting/setting NBT tags on the same side too as there are two contexts for variables - server and client context. For global variables, MCreator will sync them in 1.9.1.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
How can I create client side…
Wed, 09/18/2019 - 18:49

How can I create client side variables that persist upon leaving and rejoining the world?

Not yet, will be possible in…
Wed, 09/18/2019 - 19:15

Not yet, will be possible in 1.9.1.

In 1.9.0, you can make a server-side variable and then copy it into a session variable for the overlay use.

This page might help: https://mcreator.net/wiki/variables

The video on this page explains how to do this in 1.9.0 and how one will do this in 1.9.1.

Last seen on 20:25, 8. May 2020
Joined Aug 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
Damn, 1.9.1 sounds amazing…
Wed, 09/18/2019 - 20:26

Damn, 1.9.1 sounds amazing. So many useful things. I can't wait xD

Last seen on 05:27, 25. May 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
Hi, I'm using the most…
Wed, 12/25/2019 - 07:28

Hi,

I'm using the most current 1.9.1, and I don't understand how entity nbt data can't be passed to an overlay I'm using.

Basically I have an nbt tag set when a player does something like activate a skill, then in the overlay check the nbt tag of that player and render something if the tag is set. Right now the nbt tags are synced throughout normal player activities, but in the overlay it does NOT get the same values for the tag.

You mentioned server/client side nbt data. Is normal player activities server side and overlay client side? Can I use client side nbt data only for all contexts? If so, how do I do that?

Can I use client side nbt…
Wed, 12/25/2019 - 09:46

Can I use client side nbt data only for all contexts?

No, client side is for one client, server side for server only.

Last seen on 05:27, 25. May 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
That means I can't use…
Wed, 12/25/2019 - 11:10

That means I can't use player nbt tags in overlays right? since I'm usually modifying the nbt tag on the server side.

So now I tested using a global session variable instead, but when one player sets the variable, other players have it set too. What can I use to have a global private variable that only applies to a specific player?

As long as you set the value…
Wed, 12/25/2019 - 11:21

As long as you set the value of tags in a procedure that sets them on both sides, it should work. But we are working on improving this in the future updates, you can open as support ticket for this too so we don't forget about this one :D

Last seen on 05:27, 25. May 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
I will open a ticket. But in…
Wed, 12/25/2019 - 12:11

I will open a ticket. But in the mean time:

I'm not very proficient in server/client coding. How do I set an nbt tag on server and client side?

Last seen on 05:27, 25. May 2020
Joined Nov 2019
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • Comments:
Found a way to send the data…
Wed, 12/25/2019 - 20:14

Found a way to send the data to the client via simplenetworkwrapper packet using what I learned from you last time we talked about detecting key releases.

But this just seems so much work just to send one darn variable down to the client. If I had to implement this in every overlay I'd go nuts. Is there an easier way?