Solved How would I send a packet to the player that gives them "pumpkin" vision?

Discussion in 'Spigot Plugin Development' started by Xemor, Jan 12, 2020.

  1. Question in the title, I don't want to change their helmet to a pumpkin incase the server reboots in the middle of it and loses the helmet, it's just a lot of hassle. I'd also like to do it through packets so the player doesn't actually lose the helmet's armour benefit.
     
  2. Pretty sure the visual effect is client sided, meaning there's no way to do it without a player having a pumpkin as their helmet
     
  3. I mean you can tell the player that he has a pumpkin on his head and resetting the item when he opens his inventory.
     
  4. How would you do that 7smile7?
     
  5. ^ like he said, something like that
    Code (Text):
        public void sendFakeItem(Player p, int slot, ItemStack is) {
            EntityPlayer cp = ((CraftPlayer) p).getHandle();
            cp.playerConnection.sendPacket(new PacketPlayOutSetSlot(cp.defaultContainer.windowId, slot, CraftItemStack.asNMSCopy(is)));
        }
     
  6. Thanks, I'll do that :)