1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
package gmail.Lance5057.modifiers;
import java.util.Random;
import mods.battlegear2.api.PlayerEventChild;
import mods.battlegear2.api.core.IBattlePlayer;
import mods.battlegear2.api.core.InventoryPlayerBattle;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFireball;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.PlayerEvent;
import tconstruct.library.ActiveToolMod;
import tconstruct.library.tools.ToolCore;
public class TDefenseActiveToolMod extends ActiveToolMod {
@Override
public void updateTool(ToolCore tool, ItemStack stack, World world, Entity entity)
{
// NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
//
// if (!tags.hasKey("Broken")) {
// if(((IBattlePlayer)entity).isBlockingWithShield())
// {
// if(ShieldEvent.source.getEntity() instanceof EntityFireball)
// {
//
// }
// }
// }
}
@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;
}
}
|