-
Notifications
You must be signed in to change notification settings - Fork 755
/
BehaviorExplosive.java
70 lines (60 loc) · 1.96 KB
/
BehaviorExplosive.java
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
66
67
68
69
70
package tconstruct.util.landmine.behavior;
import java.util.List;
import mantle.common.ComparisonHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
*
* @author fuj1n
*
*/
public class BehaviorExplosive extends Behavior
{
@Override
public void executeLogic (World par1World, int par2, int par3, int par4, ItemStack par5ItemStack, Entity triggerer, boolean willBlockBeRemoved)
{
float explodeStrenght = 0;
if (ComparisonHelper.areEquivalent(par5ItemStack.getItem(), Blocks.tnt))
{
explodeStrenght = 4.0F * par5ItemStack.stackSize;
}
else if (par5ItemStack.getItem() == Items.gunpowder)
{
explodeStrenght = 0.8F * par5ItemStack.stackSize;
}
par1World.createExplosion(new EntityTNTPrimed(par1World, par2, par3, par4, (EntityLivingBase) null), par2, par3, par4, explodeStrenght, true);
}
@Override
public void getInformation (ItemStack par1ItemStack, List par2List)
{
String str = "UNDEFINED";
if (ComparisonHelper.areEquivalent(par1ItemStack.getItem(), Blocks.tnt))
{
str = "medium";
}
else if (par1ItemStack.getItem() == Items.gunpowder)
{
str = "small";
}
// par2List.add("This item explodes with " + str +
// " power when the landmine is triggered.");
}
@Override
public boolean isOffensive (ItemStack par1ItemStack)
{
return true;
}
@Override
// Change this to false to greatly decrease the maximum potential of
// explosions but at the same time, make them launch the player much
// higher(I mean the explosions with 2 or more TNT
public boolean effectStacks ()
{
return true;
}
}