I have tried 3 different ways but for each I don't know where to go from here, and I can't come up with another way.
Why do I even want this? I am trying to create a custom (chunk)hopper system where instead of all hoppers constantly looking for items above them, the item itself checks if there is a (chunk)hopper underneath it (or in the same chunk) every time it's location changes. To reduce lag.
What I tried:
-
- I tried using an Event created by spigot, the problem is that EntityMoveEvent only works for LivingEntity, and I can't find another event.
-
- I tried using NMS mojang mappings, but because the packet is clientbound I can't overwrite the channelRead() method from ChannelDuplexHandler (because it simply doesn't trigger when an entity moves), and the write() method's Object isn't a packet, instead it prints PooledUnsafeHeapByteBuf() and I have no idea what that means or if and how I can get a packet out of that https://pastes.dev/FVFGqzDGxs
-
- I tried using ProtocolLib's PacketType.Play.Server.REL_ENTITY_MOVE but I have no idea how to decode the packet into an Item instance with the correct ItemStack, Chunk, Location etc. Because the wiki is simply not simple to understand. https://pastes.dev/nk08OW7Zm2
It prints something like this when I drop an item and it moves due to gravity and velocity (The values vary) :
- I tried using ProtocolLib's PacketType.Play.Server.REL_ENTITY_MOVE but I have no idea how to decode the packet into an Item instance with the correct ItemStack, Chunk, Location etc. Because the wiki is simply not simple to understand. https://pastes.dev/nk08OW7Zm2
[16:19:13 INFO]: 47
[16:19:13 INFO]: 0
[16:19:13 INFO]: 0
[16:19:13 INFO]: 0
[16:19:13 INFO]: false
[16:19:13 INFO]: false
[16:19:13 INFO]: true