package com.learning.block; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.entity.Entity; public class DamageBlock extends Block { public DamageBlock(AbstractBlock.Settings settings) { super(settings); } public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) { if (!world.isClient()) { entity.damage((ServerWorld)world, world.getDamageSources().generic(), 6f); } } }