Zombies Follow Range...

Discussion in 'Plugin Development' started by bjsnow, Jul 18, 2013.

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

    bjsnow

    Ok, so I did this:

    Code:java
    1.  
    2. private static final UUID followRangeUID = UUID.fromString("1737400d-3c18-41ba-8314-49a158481e1e");
    3.  
    4. @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
    5. public void onEntitySpawn(CreatureSpawnEvent event){
    6. LivingEntity entity = event.getEntity();
    7.  
    8. if (entity.getType() == EntityType.ZOMBIE){
    9. EntityInsentient nmsEntity = (EntityInsentient) ((CraftLivingEntity) entity).getHandle();
    10. AttributeInstance attributes = nmsEntity.getAttributeInstance(GenericAttributes.d);
    11.  
    12. AttributeModifier modifier = new AttributeModifier(followRangeUID, "Standoff Navigation Range multiplier", 0.2d, 1);
    13.  
    14. attributes.b(modifier);
    15. }
    16. }
    17.  


    But when I spawn a zombie they still have the same view range.
     
  2. Offline

    Scyntrus

    I'm confused. Are you trying to change a mob's navigation range or movement speed?
     
  3. Offline

    bjsnow

    Navigation range.
     
  4. Offline

    Scyntrus


    This is how I set navigation range. It's completely different than yours.
    Code:java
    1.  
    2. try {
    3. Field field = Navigation.class.getDeclaredField("e");
    4. field.setAccessible(true);
    5. AttributeInstance e = (AttributeInstance) field.get(nmsEntity.getNavigation());
    6. e.setValue(32); // Navigation distance in block lengths goes here
    7. } catch (Exception ex) {
    8. }
     
Thread Status:
Not open for further replies.

Share This Page