package net.minecraft.world.level.material;

import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.tags.Tag;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.phys.Vec3;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import javax.annotation.Nullable;
import net.minecraft.core.particles.ParticleOptions;
import java.util.Random;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.core.IdMapper;

public abstract class Fluid {
    public static final IdMapper<FluidState> FLUID_STATE_REGISTRY;
    protected final StateDefinition<Fluid, FluidState> stateDefinition;
    private FluidState defaultFluidState;
    
    protected Fluid() {
        final StateDefinition.Builder<Fluid, FluidState> a2 = new StateDefinition.Builder<Fluid, FluidState>(this);
        this.createFluidStateDefinition(a2);
        this.stateDefinition = a2.<FluidStateImpl>create(FluidStateImpl::new);
        this.registerDefaultState(this.stateDefinition.any());
    }
    
    protected void createFluidStateDefinition(final StateDefinition.Builder<Fluid, FluidState> a) {
    }
    
    public StateDefinition<Fluid, FluidState> getStateDefinition() {
        return this.stateDefinition;
    }
    
    protected final void registerDefaultState(final FluidState coj) {
        this.defaultFluidState = coj;
    }
    
    public final FluidState defaultFluidState() {
        return this.defaultFluidState;
    }
    
    public abstract Item getBucket();
    
    protected void animateTick(final Level bjw, final BlockPos fk, final FluidState coj, final Random random) {
    }
    
    protected void tick(final Level bjw, final BlockPos fk, final FluidState coj) {
    }
    
    protected void randomTick(final Level bjw, final BlockPos fk, final FluidState coj, final Random random) {
    }
    
    @Nullable
    protected ParticleOptions getDripParticle() {
        return null;
    }
    
    protected abstract boolean canBeReplacedWith(final FluidState coj, final BlockGetter bjg, final BlockPos fk, final Fluid coi, final Direction fp);
    
    protected abstract Vec3 getFlow(final BlockGetter bjg, final BlockPos fk, final FluidState coj);
    
    public abstract int getTickDelay(final LevelReader bjz);
    
    protected boolean isRandomlyTicking() {
        return false;
    }
    
    protected boolean isEmpty() {
        return false;
    }
    
    protected abstract float getExplosionResistance();
    
    public abstract float getHeight(final FluidState coj, final BlockGetter bjg, final BlockPos fk);
    
    public abstract float getOwnHeight(final FluidState coj);
    
    protected abstract BlockState createLegacyBlock(final FluidState coj);
    
    public abstract boolean isSource(final FluidState coj);
    
    public abstract int getAmount(final FluidState coj);
    
    public boolean isSame(final Fluid coi) {
        return coi == this;
    }
    
    public boolean is(final Tag<Fluid> aaz) {
        return aaz.contains(this);
    }
    
    public abstract VoxelShape getShape(final FluidState coj, final BlockGetter bjg, final BlockPos fk);
    
    static {
        FLUID_STATE_REGISTRY = new IdMapper<FluidState>();
    }
}
