-
Notifications
You must be signed in to change notification settings - Fork 754
/
GlueFluid.java
74 lines (65 loc) · 2.11 KB
/
GlueFluid.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
package tconstruct.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidFinite;
import net.minecraftforge.fluids.Fluid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GlueFluid extends BlockFluidFinite
{
IIcon stillIcon;
IIcon flowIcon;
public GlueFluid(Fluid fluid, Material material)
{
super(fluid, material);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
stillIcon = iconRegister.registerIcon("tinker:liquid_glue");
flowIcon = iconRegister.registerIcon("tinker:liquid_glue_flow");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
if (side == 0 || side == 1)
return stillIcon;
return flowIcon;
}
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
entity.motionX *= 0.1;
entity.motionZ *= 0.1;
if (entity instanceof EntityLivingBase)
{
EntityLivingBase lvb = (EntityLivingBase) entity;
// Well you'd feel ill too standing in glue...
if (lvb.isPotionActive(Potion.hunger))
{
lvb.getActivePotionEffect(Potion.hunger).duration = 20;
}
else
{
lvb.addPotionEffect(new PotionEffect(Potion.hunger.getId(), 20, 4));
}
// Glue is sticky stuff
if (lvb.isPotionActive(Potion.moveSlowdown))
{
lvb.getActivePotionEffect(Potion.moveSlowdown).duration = 30;
}
else
{
lvb.addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 30, 4));
}
}
}
}