package erebus.blocks;
import erebus.ModTabs;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class BlockQuickSand extends Block {
public BlockQuickSand() {
super(Material.SAND);
setHardness(28F);
setSoundType(SoundType.SAND);
setHarvestLevel("shovel", 2);
setCreativeTab(ModTabs.BLOCKS);
}
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
return FULL_BLOCK_AABB;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World world, BlockPos pos) {
return NULL_AABB;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
entity.isAirBorne = false;
entity.setInWeb();
}
@SubscribeEvent
public void onEntityJump(LivingJumpEvent e) {
if (e.getEntity().worldObj.getBlockState(new BlockPos((int) Math.floor(e.getEntity().posX), (int) Math.floor(e.getEntity().posY) - 1, (int) Math.floor(e.getEntity().posZ))).getBlock() == this)
e.getEntityLiving().motionY = 0D;
}
}