content: package com.github.alexthe666.iceandfire.block;
  
  import com.github.alexthe666.iceandfire.entity.tile.IafTileEntityRegistry;
  import com.github.alexthe666.iceandfire.entity.tile.TileEntityGhostChest;
  import net.minecraft.core.BlockPos;
  import net.minecraft.core.Direction;
  import net.minecraft.resources.ResourceLocation;
  import net.minecraft.stats.Stat;
  import net.minecraft.stats.Stats;
  import net.minecraft.util.Mth;
  import net.minecraft.world.level.BlockGetter;
  import net.minecraft.world.level.block.ChestBlock;
  import net.minecraft.world.level.block.SoundType;
  import net.minecraft.world.level.block.entity.BlockEntity;
  import net.minecraft.world.level.block.entity.ChestBlockEntity;
  import net.minecraft.world.level.block.state.BlockState;
  import net.minecraft.world.level.material.Material;
  import org.jetbrains.annotations.NotNull;
  
  public class BlockGhostChest extends ChestBlock {
  
      public BlockGhostChest() {
          super(
              Properties
                  .of(Material.WOOD)
                  .strength(2.5F)
                  .sound(SoundType.WOOD),
              () -> {
                  return IafTileEntityRegistry.GHOST_CHEST.get();
              }
          );
      }
  
      @Override
      public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
          return new TileEntityGhostChest(pos, state);
      }
  
      @Override
      protected @NotNull Stat<ResourceLocation> getOpenChestStat() {
          return Stats.CUSTOM.get(Stats.TRIGGER_TRAPPED_CHEST);
      }
  
      @Override
      public boolean isSignalSource(@NotNull BlockState state) {
          return true;
      }
  
      @Override
      public int getSignal(@NotNull BlockState blockState, @NotNull BlockGetter blockAccess, @NotNull BlockPos pos, @NotNull Direction side) {
          return Mth.clamp(ChestBlockEntity.getOpenCount(blockAccess, pos), 0, 15);
      }
  
      @Override
      public int getDirectSignal(@NotNull BlockState blockState, @NotNull BlockGetter blockAccess, @NotNull BlockPos pos, @NotNull Direction side) {
          return side == Direction.UP ? blockState.getSignal(blockAccess, pos, side) : 0;
      }
  }
  