How to work with server-side/client-side NBT tags?

Started by StellaeLux on Sat, 10/12/2019 - 16:13

Topic category: Help with MCreator's application

Last seen on 15:31, 13. Nov 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
How to work with server-side/client-side NBT tags?
Sat, 10/12/2019 - 16:13

Each variable has 2 values: 1 value on the client side and 1 on the server side. Using [World Data] Is provided world remote (client side) and the NOT option, it's possible to check whether something is either server or client side.

Currently, I want to use On Player Tick Update/Player Joins the World (Server Side only) to set an NBT tag to 10 for example. Then I want to check for that NBT tag in the Overlay procedures (Client Side only).

How would I be able to achieve that?

Using [World Data] Is…
Sat, 10/12/2019 - 18:20

Using [World Data] Is provided world remote (client side) and the NOT option

Why not? This is the standard way to do this for most things, even when not using MCreator but with plain Java code.

Last seen on 15:31, 13. Nov 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I meant: if "Is provided…
Sun, 10/13/2019 - 01:00

I meant: if "Is provided world remote (client side)" // = client side.

do...

if NOT "Is provided world remote (client side)" // = server side.

do...

Then I am not sure I…
Sun, 10/13/2019 - 09:41

Then I am not sure I understood you properly. You want to hold a separate set of NBT tags for client and server-side?

Last seen on 15:31, 13. Nov 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
I need to set an entity NBT…
Sun, 10/13/2019 - 13:26

I need to set an entity NBT tag "Counter" in a server only procedure and use the value in a client only procedure. (The player tick, server only and overlay client only).

This is what will happen:

Setting the NBT tag to 10 in on player tick: Counter Client side = 0, Counter Server side = 10.

Then I need to check the value in overlay: Checks client side = 0.

I was wondering how I could manage to be able to see the 10 instead of the 0.

I am not sure if you can do…
Sun, 10/13/2019 - 13:32

I am not sure if you can do this as NBT should be assumed to be synchronized and should be. If you are doing this for a player entity, consider using GLOBAL_SESSION instead which is stored per player/client on the client-side.

Last seen on 15:31, 13. Nov 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Thanks!
Sun, 10/13/2019 - 16:22

Thanks!

Last seen on 15:31, 13. Nov 2019
Joined Aug 2019
User points:

Statistics:

  • Comments:
  • Forum topics:
  • Modifications:
  • Wiki pages:
Done deal!
Sun, 10/13/2019 - 19:02

Done deal!