package net.minecraft.world.level;

import java.util.Optional;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.core.BlockPos;

public enum DefaultExplosionDamageCalculator implements ExplosionDamageCalculator {
    INSTANCE;
    
    @Override
    public Optional<Float> getBlockExplosionResistance(final Explosion bpt, final BlockGetter bpg, final BlockPos fu, final BlockState cfj, final FluidState cxa) {
        if (cfj.isAir() && cxa.isEmpty()) {
            return Optional.<Float>empty();
        }
        return Optional.<Float>of(Math.max(cfj.getBlock().getExplosionResistance(), cxa.getExplosionResistance()));
    }
    
    @Override
    public boolean shouldBlockExplode(final Explosion bpt, final BlockGetter bpg, final BlockPos fu, final BlockState cfj, final float float5) {
        return true;
    }
}
