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;
import net.minecraft.world.entity.Entity;

class EntityBasedExplosionDamageCalculator implements ExplosionDamageCalculator {
    private final Entity source;
    
    EntityBasedExplosionDamageCalculator(final Entity aom) {
        this.source = aom;
    }
    
    @Override
    public Optional<Float> getBlockExplosionResistance(final Explosion bpt, final BlockGetter bpg, final BlockPos fu, final BlockState cfj, final FluidState cxa) {
        return DefaultExplosionDamageCalculator.INSTANCE.getBlockExplosionResistance(bpt, bpg, fu, cfj, cxa).<Float>map(float6 -> this.source.getBlockExplosionResistance(bpt, bpg, fu, cfj, cxa, float6));
    }
    
    @Override
    public boolean shouldBlockExplode(final Explosion bpt, final BlockGetter bpg, final BlockPos fu, final BlockState cfj, final float float5) {
        return this.source.shouldBlockExplode(bpt, bpg, fu, cfj, float5);
    }
}
