Files
TinkersConstruct/src/main/java/tconstruct/blocks/GlueBlock.java
T

49 lines
1.6 KiB
Java
Raw Normal View History

package tconstruct.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
2014-02-01 16:06:02 -05:00
import net.minecraft.init.Blocks;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
public class GlueBlock extends TConstructBlock {
public GlueBlock()
{
2014-01-10 21:14:54 -05:00
super(Material.field_151578_c, 4.0f, new String[]{"glue"});
}
@Override
2014-01-30 20:34:22 -05:00
public void func_149670_a (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 on 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));
}
}
}
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
2014-02-01 16:06:02 -05:00
return Blocks.soul_sand.func_149668_a(world, x, y, z);
}
}