package net.minecraft.world.level.block;

import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.entity.TheEndGatewayBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.BlockGetter;

public class EndGatewayBlock extends BaseEntityBlock {
    protected EndGatewayBlock(final Properties c) {
        super(c);
    }
    
    @Override
    public BlockEntity newBlockEntity(final BlockGetter bjg) {
        return new TheEndGatewayBlockEntity();
    }
    
    @Override
    public void animateTick(final BlockState byj, final Level bjw, final BlockPos fk, final Random random) {
        final BlockEntity bwl6 = bjw.getBlockEntity(fk);
        if (!(bwl6 instanceof TheEndGatewayBlockEntity)) {
            return;
        }
        for (int integer7 = ((TheEndGatewayBlockEntity)bwl6).getParticleAmount(), integer8 = 0; integer8 < integer7; ++integer8) {
            double double9 = fk.getX() + (double)random.nextFloat();
            final double double10 = fk.getY() + (double)random.nextFloat();
            double double11 = fk.getZ() + (double)random.nextFloat();
            double double12 = (random.nextFloat() - 0.5) * 0.5;
            final double double13 = (random.nextFloat() - 0.5) * 0.5;
            double double14 = (random.nextFloat() - 0.5) * 0.5;
            final int integer9 = random.nextInt(2) * 2 - 1;
            if (random.nextBoolean()) {
                double11 = fk.getZ() + 0.5 + 0.25 * integer9;
                double14 = random.nextFloat() * 2.0f * integer9;
            }
            else {
                double9 = fk.getX() + 0.5 + 0.25 * integer9;
                double12 = random.nextFloat() * 2.0f * integer9;
            }
            bjw.addParticle(ParticleTypes.PORTAL, double9, double10, double11, double12, double13, double14);
        }
    }
    
    @Override
    public ItemStack getCloneItemStack(final BlockGetter bjg, final BlockPos fk, final BlockState byj) {
        return ItemStack.EMPTY;
    }
    
    @Override
    public boolean canBeReplaced(final BlockState byj, final Fluid coi) {
        return false;
    }
}
