I want to make a block that instantly killes you, this is what I have done so far:
public class ModDeathBlock extends Block {
public ModDeathBlock(Material materialIn) {
super(materialIn, MapColor.RED);
this.setHarvestLevel("pickaxe", 2);
this.setSoundType(SoundType.STONE);
}
@Override
public void onEntityWalk(World worldIn, BlockPos pos, Entity entityIn) {
if (entityIn instanceof EntityLivingBase) {
entityIn.attackEntityFrom(ModElements.death_block, 100000000 * 100000000);
if(entityIn.isSneaking()){
entityIn.attackEntityFrom(ModElements.death_block, 100000000 * 100000000);
}
}
}
}
The problem is that entitys/players don't take any damages when sneaking or touching it from the side, how should I fix it?