content: package com.accbdd.complicated_bees.block;
  
  import com.accbdd.complicated_bees.block.entity.gyrofuge.GyrofugeEnergyCellBlockEntity;
  import net.minecraft.core.BlockPos;
  import net.minecraft.network.chat.Component;
  import net.minecraft.world.InteractionHand;
  import net.minecraft.world.InteractionResult;
  import net.minecraft.world.entity.player.Player;
  import net.minecraft.world.level.Level;
  import net.minecraft.world.level.block.entity.BlockEntity;
  import net.minecraft.world.level.block.state.BlockState;
  import net.minecraft.world.phys.BlockHitResult;
  
  import java.text.DecimalFormat;
  
  public class GyrofugeEnergyCellBlock extends GyrofugeBlock {
      public static final DecimalFormat FORMAT = new DecimalFormat("0.##");
  
      @Override
      public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) {
          return new GyrofugeEnergyCellBlockEntity(pPos, pState);
      }
  
      @Override
      public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Player pPlayer, InteractionHand pHand, BlockHitResult pHit) {
          if (!pLevel.isClientSide() && pLevel.getBlockEntity(pPos) instanceof GyrofugeEnergyCellBlockEntity cell) {
              pPlayer.displayClientMessage(Component.translatable("gui.complicated_bees.energy_cell",
                      FORMAT.format(cell.getEnergy().getEnergyStored() / 1000D),
                      FORMAT.format(cell.getEnergy().getMaxEnergyStored() / 1000D)), true);
              return InteractionResult.CONSUME;
          }
          return super.use(pState, pLevel, pPos, pPlayer, pHand, pHit);
      }
  }
  