diff options
Diffstat (limited to 'src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java')
| -rw-r--r-- | src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java b/src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java new file mode 100644 index 0000000..d03779b --- /dev/null +++ b/src/main/java/gmail/Lance5057/modifiers/TDefenseActiveToolMod.java @@ -0,0 +1,41 @@ +package gmail.Lance5057.modifiers; + +import java.util.Random; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import tconstruct.library.ActiveToolMod; +import tconstruct.library.tools.ToolCore; + +public class TDefenseActiveToolMod extends ActiveToolMod { + @Override + public int baseAttackDamage(int earlyModDamage, int damage, ToolCore tool, + NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack, + EntityLivingBase player, Entity entity) { + if (!toolTags.hasKey("Broken")) { + if (toolTags.hasKey("Daze")) { + int[] array = toolTags.getIntArray("Daze"); + int chance = array[0] * 5; + + Random roll = new Random(); + int num = roll.nextInt(100) + 1; + + if (num <= chance) { + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect(2, 3 * 20, 100)); + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect(9, 3 * 20, 100)); + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect(15, 3 * 20, 100)); + ((EntityLivingBase) entity) + .addPotionEffect(new PotionEffect(18, 3 * 20, 100)); + } + } + } + + return 0; + } +} |
