package net.minecraft.core;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.Level;

public class BlockSourceImpl implements BlockSource {
    private final Level level;
    private final BlockPos pos;
    
    public BlockSourceImpl(final Level bjw, final BlockPos fk) {
        this.level = bjw;
        this.pos = fk;
    }
    
    @Override
    public Level getLevel() {
        return this.level;
    }
    
    @Override
    public double x() {
        return this.pos.getX() + 0.5;
    }
    
    @Override
    public double y() {
        return this.pos.getY() + 0.5;
    }
    
    @Override
    public double z() {
        return this.pos.getZ() + 0.5;
    }
    
    @Override
    public BlockPos getPos() {
        return this.pos;
    }
    
    @Override
    public BlockState getBlockState() {
        return this.level.getBlockState(this.pos);
    }
    
    @Override
    public <T extends BlockEntity> T getEntity() {
        return (T)this.level.getBlockEntity(this.pos);
    }
}
