In my plugin, I’m trying to make instanced areas, much like you’d see in any MMO game. To do this, I’d need entities to be spawned per-instance. Now coming from Spigot, I would’ve done this with NMS and packets. I know Sponge has its DataAPI which (I believe) tries to steer us away from using NMS and packets as much as possible. Not knowing much, or really anything about the DataAPI, I was wondering if this is possible with it? Or would I have to go back to using NMS and packets?
I am not sure what you mean by ‘instance’, but spawning entities regardless of behavior does not require NMS.
Alrighty. So let’s say our map has a cave. You and I are both in the cave, but we each have our own instances. I can’t see you, and you can’t see me. All the zombies I’m fighting and particles I’m shooting also can’t be seen by you, and vice versa. That’s what I mean by instance. I hope that makes more sense xD
So Sponge has some way of allowing me to do per-client things, such as having me see zombies and you see bats in our own separate “instances” without having to use NMS and packets?
That… is a very interesting concept. I’m not aware of any immediate way of doing it in Sponge. The only real way would be to load a new world for every player.
The Data API is a way of standardizing data; rather than having concrete getter and setter methods (e.g.
getMaxHealth(), etc), it reduces it to simply
offer(), and turns to separate holder classes (
DataManipulators) to hold the data. This allows for arbitrary persistent data to be saved to things implementing
DataHolder, and it is eventually serialized to NBT. It’s a wonderful system, but its only relationship to NMS is as an alternative for editing NBT directly.
It’s a common concept in MMOs and such. haha. And I gotcha. That makes sense. I could use that DataAPI to save what “instance” the entity belongs to, but would still have to do all the spawning myself I suppose.
Okay, same kinda question. In Spigot, there was a simple
method. This allowed me to make the Player passed to the method get “hidden” from the first Player’s view. It wasn’t just throwing an invisible effect on them and calling it good. Some kinda packet-y goodness I assume. Does Sponge have any similar
that you are aware of? Or would I have to resort to using a potion effect or figuring out the packets?
Also, do you know of any Sponge dev I could maybe tag to get their opinions on this???
Oh no kidding. Now that’s nice. haha. Would I be able to specify which players can no longer see the player I’m vanishing or is it more an all-inclusive ‘that player vanishes for everyone else’?
It’s what you said; things are vanished overall rather than per-player.
Ah okay. I’ll have to figure out the packets for that too then