Question regarding non-player entities

Discussion in 'Plugin Development' started by Caprei, Oct 23, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Caprei

    Hey all,
    I've recently been trying to find out how I can do certain things to entities. I'd like to change the health of these entities, set maximum no damage ticks, however there aren't any methods for this. Is it even possible to set the health of any entity? Thanks.
     
  2. Offline

    mythbusterma

    Caprei

    You have to use a LivingEntity instead of Entity, as many entities don't have properties like that, only living ones do. Cast whatever you're trying to assign to a LivingEntity, after doing an assignment check, of course.
     
    Caprei likes this.
  3. Offline

    97WaterPolo

    Caprei
    Well if you are referring to Zombie, Cows, Skeletons, Creepers, etc?

    Not sure but I believe you can do something like

    If (e instanceof LivingEnitity)
    LivingEntity le = (LivingEntity) e;
    Le.setHealth();

    If you want more specific modifications, ie wolves.

    If (e.getEntityType == EntityType.wolf)
    Wolf w = (Wolf) e;
    W.setOwner();
    W.setCustomName();
    W.setCustomNameVisible();

    Edit: damn, ninjad by muthbusterma
     
    Caprei likes this.
  4. Offline

    Caprei

    97WaterPolo likes this.
Thread Status:
Not open for further replies.

Share This Page