package minestrapteam.mods.minestrappolation.block; import minestrapteam.mods.minestrappolation.Minestrappolation; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.BlockPos; import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.Random; public class BlockColdCobweb extends MBlock { public BlockColdCobweb() { super(Material.web, MapColor.airColor); this.setCreativeTab(Minestrappolation.tabMDecor); } @Override public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { entityIn.setInWeb(); if (entityIn instanceof EntityLivingBase) { ((EntityLivingBase) entityIn) .addPotionEffect(new PotionEffect(Potion.moveSlowdown.getId(), 20 * 10, 2, false, false)); ((EntityLivingBase) entityIn) .addPotionEffect(new PotionEffect(Potion.digSlowdown.getId(), 20 * 10, 2, false, false)); } } @Override public boolean isOpaqueCube() { return false; } @Override public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) { return null; } @Override public boolean isFullCube() { return false; } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return Items.string; } @Override protected boolean canSilkHarvest() { return true; } @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return EnumWorldBlockLayer.TRANSLUCENT; } }