Search in sources :

Example 16 with AttributeModifier

use of net.minecraft.server.v1_15_R1.AttributeModifier in project NoCheatPlus by NoCheatPlus.

the class AttributeAccess method getSpeedAttributeMultiplier.

@Override
public double getSpeedAttributeMultiplier(Player player) {
    final AttributeInstance attr = ((CraftLivingEntity) player).getHandle().getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
    final double val = attr.getValue() / attr.b();
    final AttributeModifier mod = attr.a(AttribUtil.ID_SPRINT_BOOST);
    if (mod == null) {
        return val;
    } else {
        return val / AttribUtil.getMultiplier(mod.c(), mod.d());
    }
}
Also used : AttributeInstance(net.minecraft.server.v1_8_R3.AttributeInstance) AttributeModifier(net.minecraft.server.v1_8_R3.AttributeModifier)

Aggregations

UUID (java.util.UUID)1 AttributeInstance (net.minecraft.server.v1_10_R1.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_10_R1.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_11_R1.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_11_R1.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_12_R1.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_12_R1.AttributeModifier)1 AttributeModifier (net.minecraft.server.v1_15_R1.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_6_R1.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_6_R1.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_6_R2.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_6_R2.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_6_R3.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_6_R3.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_7_R1.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_7_R1.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_7_R2.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_7_R2.AttributeModifier)1 AttributeInstance (net.minecraft.server.v1_7_R3.AttributeInstance)1 AttributeModifier (net.minecraft.server.v1_7_R3.AttributeModifier)1