package net.minecraft.world.level.block;

import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.stats.Stats;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.network.chat.Component;
import net.minecraft.world.SimpleMenuProvider;
import net.minecraft.world.inventory.SmithingMenu;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.MenuProvider;
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.state.BlockBehaviour;
import net.minecraft.network.chat.TranslatableComponent;

public class SmithingTableBlock extends CraftingTableBlock {
    private static final TranslatableComponent CONTAINER_TITLE;
    
    protected SmithingTableBlock(final Properties c) {
        super(c);
    }
    
    @Override
    public MenuProvider getMenuProvider(final BlockState cfj, final Level bqb, final BlockPos fu) {
        return new SimpleMenuProvider((integer, beb, bec) -> new SmithingMenu(integer, beb, ContainerLevelAccess.create(bqb, fu)), SmithingTableBlock.CONTAINER_TITLE);
    }
    
    @Override
    public InteractionResult use(final BlockState cfj, final Level bqb, final BlockPos fu, final Player bec, final InteractionHand anf, final BlockHitResult deh) {
        if (bqb.isClientSide) {
            return InteractionResult.SUCCESS;
        }
        bec.openMenu(cfj.getMenuProvider(bqb, fu));
        bec.awardStat(Stats.INTERACT_WITH_SMITHING_TABLE);
        return InteractionResult.CONSUME;
    }
    
    static {
        CONTAINER_TITLE = new TranslatableComponent("container.upgrade");
    }
}
