Java 类net.minecraft.server.GenericAttributes 实例源码

项目:Craftbukkit    文件:CraftGuardian.java   
@Override
public void setElder( boolean shouldBeElder ) {
    EntityGuardian entityGuardian = (EntityGuardian) entity;

    if (!isElder() && shouldBeElder) {
        entityGuardian.setElder(true);
    } else if (isElder() && !shouldBeElder) {
        entityGuardian.setElder(false);

        // Since minecraft does not reset the elder Guardian to a guardian we have to do that
        entity.setSize(0.85F, 0.85F);

        // Since aW() calls its supers it will try to re register attributes which is invalid
        // check these on update
        entityGuardian.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6.0D);
        entityGuardian.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D);
        entityGuardian.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(16.0D);
        entityGuardian.getAttributeInstance(GenericAttributes.maxHealth).setValue(30.0D);

        // Update pathfinding (random stroll back to 80)
        entityGuardian.goalRandomStroll.setTimeBetweenMovement(80);

        // Tell minecraft that we need persistence since the guardian changed
        entityGuardian.initAttributes();
    }
}
项目:SpigotSource    文件:CraftGuardian.java   
@Override
public void setElder( boolean shouldBeElder ) {
    EntityGuardian entityGuardian = (EntityGuardian) entity;

    if (!isElder() && shouldBeElder) {
        entityGuardian.setElder(true);
    } else if (isElder() && !shouldBeElder) {
        entityGuardian.setElder(false);

        // Since minecraft does not reset the elder Guardian to a guardian we have to do that
        entity.setSize(0.85F, 0.85F);

        // Since aW() calls its supers it will try to re register attributes which is invalid
        // check these on update
        entityGuardian.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6.0D);
        entityGuardian.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D);
        entityGuardian.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(16.0D);
        entityGuardian.getAttributeInstance(GenericAttributes.maxHealth).setValue(30.0D);

        // Update pathfinding (random stroll back to 80)
        entityGuardian.goalRandomStroll.setTimeBetweenMovement(80);

        // Tell minecraft that we need persistence since the guardian changed
        entityGuardian.initAttributes();
    }
}
项目:CraftBukkit    文件:CraftLivingEntity.java   
public void setMaxHealth(double amount) {
    Validate.isTrue(amount > 0, "Max health must be greater than 0");

    getHandle().getAttributeInstance(GenericAttributes.maxHealth).setValue(amount);

    if (getHealth() > amount) {
        setHealth(amount);
    }
}
项目:Craftbukkit    文件:CraftLivingEntity.java   
public void setMaxHealth(double amount) {
    Validate.isTrue(amount > 0, "Max health must be greater than 0");

    getHandle().getAttributeInstance(GenericAttributes.maxHealth).setValue(amount);

    if (getHealth() > amount) {
        setHealth(amount);
    }
}
项目:Almura-Server    文件:CraftLivingEntity.java   
public void setMaxHealth(double amount) {
    Validate.isTrue(amount > 0, "Max health must be greater than 0");

    getHandle().getAttributeInstance(GenericAttributes.a).setValue(amount);

    if (getHealth() > amount) {
        setHealth(amount);
    }
}
项目:Tweakkit-Server    文件:CraftLivingEntity.java   
public void setMaxHealth(double amount) {
    Validate.isTrue(amount > 0, "Max health must be greater than 0");

    getHandle().getAttributeInstance(GenericAttributes.maxHealth).setValue(amount);

    if (getHealth() > amount) {
        setHealth(amount);
    }
}
项目:Tweakkit-Server    文件:SpigotConfig.java   
private static void attributeMaxes()
{
    maxHealth = getDouble( "settings.attribute.maxHealth.max", maxHealth );
    ( (AttributeRanged) GenericAttributes.maxHealth ).b = maxHealth;
    movementSpeed = getDouble( "settings.attribute.movementSpeed.max", movementSpeed );
    ( (AttributeRanged) GenericAttributes.d ).b = movementSpeed;
    attackDamage = getDouble( "settings.attribute.attackDamage.max", attackDamage );
    ( (AttributeRanged) GenericAttributes.e ).b = attackDamage;
}
项目:SpigotSource    文件:CraftLivingEntity.java   
public void setMaxHealth(double amount) {
    Validate.isTrue(amount > 0, "Max health must be greater than 0");

    getHandle().getAttributeInstance(GenericAttributes.maxHealth).setValue(amount);

    if (getHealth() > amount) {
        setHealth(amount);
    }
}
项目:SpigotSource    文件:SpigotConfig.java   
private static void attributeMaxes()
{
    maxHealth = getDouble( "settings.attribute.maxHealth.max", maxHealth );
    ( (AttributeRanged) GenericAttributes.maxHealth ).b = maxHealth;
    movementSpeed = getDouble( "settings.attribute.movementSpeed.max", movementSpeed );
    ( (AttributeRanged) GenericAttributes.MOVEMENT_SPEED ).b = movementSpeed;
    attackDamage = getDouble( "settings.attribute.attackDamage.max", attackDamage );
    ( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage;
}