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

Started by StellaeLux on

Topic category: Help with MCreator software

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to work with server-side/client-side NBT tags?

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.

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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...

Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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.

Joined Aug 2019
Points:

User statistics:

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

Done deal!