-
Notifications
You must be signed in to change notification settings - Fork 755
/
SlimeGel.java
83 lines (73 loc) · 2.45 KB
/
SlimeGel.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
71
72
73
74
75
76
77
78
79
80
81
82
83
package tconstruct.blocks.slime;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import tconstruct.blocks.TConstructBlock;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlimeGel extends TConstructBlock
{
public SlimeGel()
{
super(Material.sponge, 0.5f, new String[] { "slimeblock_blue", "slimeblock_green", "slimeblock_purple" });
setCreativeTab(TConstructRegistry.blockTab);
}
public boolean getEnableStats ()
{
return false;
}
public int getMobilityFlag ()
{
return 0;
}
public int damageDropped (int meta)
{
return meta;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
if (entity.motionY < 0)
{
if (entity.motionY < -0.08F)
{
Block var9 = (Block) this;
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var9.stepSound.getStepSound(), (var9.stepSound.getVolume()) / 2.0F, var9.stepSound.getPitch() * 0.65F);
}
entity.motionY *= -1.2F;
if (entity instanceof EntityLivingBase)
{
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.jump.id, 1, 2));
}
}
entity.fallDistance = 0;
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
}
@SideOnly(Side.CLIENT)
/**
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
*/
public void getSubBlocks (Block b, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(b, 1, 0));
par3List.add(new ItemStack(b, 1, 1));
//par3List.add(new ItemStack(par1, 1, 2));
}
public boolean canSustainLeaves (World world, int x, int y, int z)
{
return true;
}
}