package net.minecraft.world.level.block;

import net.minecraft.core.particles.SimpleParticleType;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.player.Player;
import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.tags.Tag;
import net.minecraft.tags.FluidTags;
import net.minecraft.core.Direction;
import net.minecraft.world.level.LevelAccessor;
import java.util.Random;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockBehaviour;

public class MagmaBlock extends Block {
    public MagmaBlock(final Properties c) {
        super(c);
    }
    
    @Override
    public void stepOn(final Level bqb, final BlockPos fu, final Entity aom) {
        if (!aom.fireImmune() && aom instanceof LivingEntity && !EnchantmentHelper.hasFrostWalker((LivingEntity)aom)) {
            aom.hurt(DamageSource.HOT_FLOOR, 1.0f);
        }
        super.stepOn(bqb, fu, aom);
    }
    
    @Override
    public void tick(final BlockState cfj, final ServerLevel zd, final BlockPos fu, final Random random) {
        BubbleColumnBlock.growColumn(zd, fu.above(), true);
    }
    
    @Override
    public BlockState updateShape(final BlockState cfj1, final Direction fz, final BlockState cfj3, final LevelAccessor bqc, final BlockPos fu5, final BlockPos fu6) {
        if (fz == Direction.UP && cfj3.is(Blocks.WATER)) {
            bqc.getBlockTicks().scheduleTick(fu5, this, 20);
        }
        return super.updateShape(cfj1, fz, cfj3, bqc, fu5, fu6);
    }
    
    @Override
    public void randomTick(final BlockState cfj, final ServerLevel zd, final BlockPos fu, final Random random) {
        final BlockPos fu2 = fu.above();
        if (zd.getFluidState(fu).is(FluidTags.WATER)) {
            zd.playSound(null, fu, SoundEvents.FIRE_EXTINGUISH, SoundSource.BLOCKS, 0.5f, 2.6f + (zd.random.nextFloat() - zd.random.nextFloat()) * 0.8f);
            zd.<SimpleParticleType>sendParticles(ParticleTypes.LARGE_SMOKE, fu2.getX() + 0.5, fu2.getY() + 0.25, fu2.getZ() + 0.5, 8, 0.5, 0.25, 0.5, 0.0);
        }
    }
    
    @Override
    public void onPlace(final BlockState cfj1, final Level bqb, final BlockPos fu, final BlockState cfj4, final boolean boolean5) {
        bqb.getBlockTicks().scheduleTick(fu, this, 20);
    }
}
