1.8.8 Customizing an entity (1.8.8)

Discussion in 'Spigot Plugin Development' started by Osicool, Feb 9, 2020.

  1. When I try and access my entity variable and try to change its health and gravity there are no options/methods. Yes, I have looked in the 1.8.8 documentation and there are no setHealth/invincibility or hasGravity methods so I'm just wondering how you would do that in 1.8.8 Minecraft.
    Code (Text):
        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String string, String[] args) {
            Player player = (Player) sender;
            Entity entity = player.getWorld().spawnEntity(player.getLocation(), EntityType.CREEPER);
            /*
            Set entity health to invulnerable
            Set entity hasGravity to false.
             */
            return false;
        }
     
  2. You can listen an EntityDamageByEntityEvent and cancel if the hit entity is a creeper.
    I dont have idea for hasGravity. Probablay something like EntityVelocityEvent