diff --git a/common/buildcraft/robotics/EntityRobot.java b/common/buildcraft/robotics/EntityRobot.java index 240fdf44..4d37c548 100644 --- a/common/buildcraft/robotics/EntityRobot.java +++ b/common/buildcraft/robotics/EntityRobot.java @@ -15,6 +15,7 @@ import java.util.Set; import java.util.WeakHashMap; import com.google.common.collect.Iterables; +import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; @@ -24,6 +25,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.entity.monster.IMob; import net.minecraft.entity.player.EntityPlayer; @@ -1051,9 +1054,26 @@ public class EntityRobot extends EntityRobotBase implements if (par1Entity.canAttackWithItem()) { if (!par1Entity.hitByEntity(this)) { + Multimap attributes = itemInUse != null ? (Multimap) itemInUse.getAttributeModifiers() : null; float attackDamage = 2.0F; int knockback = 0; + if (attributes != null) { + for (AttributeModifier modifier : attributes.get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName())) { + switch (modifier.getOperation()) { + case 0: + attackDamage += modifier.getAmount(); + break; + case 1: + attackDamage *= modifier.getAmount(); + break; + case 2: + attackDamage *= 1.0F + modifier.getAmount(); + break; + } + } + } + if (par1Entity instanceof EntityLivingBase) { attackDamage += EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase) par1Entity); knockback += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase) par1Entity);