player.hurt( DamageSource.GENERIC, 2);
Код: Выделить всё
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.state.BlockState;
public class DamageProcedure {
public static void execute(Player player, BlockState state) {
if (state.is(BlockTags.LOGS) && player.getMainHandItem().isEmpty()) {
player.hurt(DamageSource.GENERIC, 2);
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... ng-a-error
Мобильная версия