ProtocolLib

3M Downloads

How to spawn an item with ProtocolLib for one player ?

MrClean1337 opened this issue ยท 3 comments

commented

Make sure you're doing the following

  • [True] You're using the latest build for your server version
  • [True] This isn't an issue caused by another plugin
  • [True] You've checked for duplicate issues
  • [True] You didn't use /reload

Describe the question
Hello and yes I know that this is the wrong section, but I think you guys are my last hope before giving up with ProtocolLib :/
Im not really able to understand and spawn a item with ProtocolLib.
Im really really new to ProtocolLib, because in the past I used only NMS.
Any detailed tutorials are welcome for me :D
Is here a more detailed Tutorial?
Is there for ProtocolLib a discussion section like a discord or something ?

As far as I know, I need these two:

  1. https://wiki.vg/Protocol#Spawn_Entity
  2. https://wiki.vg/Protocol#Entity_Metadata

But im not really able to understand and spawn a item with ProtocolLib!
Im trying to spawn a item with this lines of code:
https://pastebin.com/Rz4nfT5i

But it just appears this:
https://i.imgur.com/Jbqt7LO.png

Why ? I just want to spawn an item with ProtocolLib for one player.
And in the code at the MetaData part, I really don't know how to attach an ItemStack to it.
Any ideas ?

Im using git-Tuinity-23 (MC: 1.17.1) and ProtocolLib v4.7.0

Maybe, you're my last hope. Thanks :/

commented

WrappedDataWatcherObject(index??,
WrappedDataWatcher.Registry.getItemStackSerializer(false)), istack);

1.12: 6
1.17 maybe 8

commented

WrappedDataWatcherObject(index??,
WrappedDataWatcher.Registry.getItemStackSerializer(false)), istack);

1.12: 6
1.17 maybe 8

Ah yes thats right, it is index 8.

But the code from the "ENTITY_METADATA" is not important right now and its not causing the bug given from the picture.
These black potion particle spawns even if I only send the "SPAWN_ENTITY" packet.
But thats totally the wrong thing, it should be an Item.

I tested around and disabled all outgoing "ENTITY_METADATA" packets.
Then I dropped a stone item out of my inventory, but nothing happens.
The "SPAWN_ENTITY" packet was sent from the drop.

So normally if I only send the "SPAWN_ENTITY", nothing should happen. Like my test.

Bruh I need community platform, where I can write with protocolLib experts, I dont want to ask on the "Issue" section xd

commented

Is there a workaround, where I can output all information about a PacketContainer ?
If I try toString, it simply puts out the class without values an so on