Solved .setInvisible(true) not working? (Hiding Entities)

Discussion in 'Spigot Plugin Development' started by zException_, Dec 8, 2018 at 3:36 PM.

  1. Im trying to create invisible giants with items in their hands but they wont get invisible

    My Code:
    Code (Java):
    EntityGiantZombie giant = new EntityGiantZombie( ((CraftWorld) p.getWorld()).getHandle() );

                    NBTTagCompound tag = giant.getNBTTag();
                    giant.setEquipment(0, CraftItemStack.asNMSCopy(new ItemStack(Material.TRIPWIRE_HOOK)));

                    if (tag == null) tag = new NBTTagCompound();
                    giant.c(tag);
                    tag.setInt("NoAI", 1);
                    tag.setInt("NoGravity", 1);
                    tag.setInt("Silent", 1);
                    tag.setInt("Invulnerable", 1);
                    giant.f(tag);

                    giant.setInvisible(true);
                    giant.setLocation(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ(), p.getLocation().getPitch(), p.getLocation().getYaw());

                    ((CraftWorld) p.getWorld()).getHandle().addEntity(giant, CreatureSpawnEvent.SpawnReason.CUSTOM);
     
  2. Just set invisibility effect
     
    • Winner Winner x 1
  3. i dont want the particles
     
  4. maybe check if there is a tag invisible that you can set?
     
  5. You can disable the particles.
     
  6. tag.setInt("Invisible", 1);

    https://minecraft.gamepedia.com/Tutorials/Command_NBT_tags
     
  7. PotionEffect has a constructor with a particles parameter.
     
  8. Oops, you're right.
     
  9. thanks it worked :D
     

Share This Page