net.minecraft.entity.EnumCreatureAttribute Java Examples

The following examples show how to use net.minecraft.entity.EnumCreatureAttribute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinEnchantmentHelper.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @reason Fix memory leak. See mixin class comment. */
@Overwrite
public static float getModifierForCreature(ItemStack stack, EnumCreatureAttribute creatureAttribute) {
    EnchantmentHelper.ModifierLiving enchantmentModifierLiving = new EnchantmentHelper.ModifierLiving();
    enchantmentModifierLiving.livingModifier = 0.0F;
    enchantmentModifierLiving.entityLiving = creatureAttribute;
    applyEnchantmentModifier(enchantmentModifierLiving, stack);
    return enchantmentModifierLiving.livingModifier;
}
 
Example #2
Source File: AutoTool.java    From ForgeHax with MIT License 5 votes vote down vote up
private double getEntityAttackModifier(InvItem item, Entity target) {
  return EnchantmentHelper.getModifierForCreature(
      item.getItemStack(),
      Optional.ofNullable(target)
          .filter(EntityLivingBase.class::isInstance)
          .map(EntityLivingBase.class::cast)
          .map(EntityLivingBase::getCreatureAttribute)
          .orElse(EnumCreatureAttribute.UNDEFINED));
}
 
Example #3
Source File: EntityBackupZombie.java    From Wizardry with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Nonnull
@Override
public EnumCreatureAttribute getCreatureAttribute() {
	return EnumCreatureAttribute.UNDEAD;
}
 
Example #4
Source File: EntityEndermite.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public EnumCreatureAttribute getCreatureAttribute() {
	return EnumCreatureAttribute.ARTHROPOD;
}
 
Example #5
Source File: EnchantmentWrath.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 4 votes vote down vote up
public float func_152376_a(int level, EnumCreatureAttribute target)
{
    return (float)level * 1.25F;
}