// package jesse.keeblarcraft.CustomBlocks.BlockEntities;

// import jesse.keeblarcraft.Keeblarcraft;
// import jesse.keeblarcraft.CustomBlocks.BlockManager;
// import jesse.keeblarcraft.world.ImplementedInventory;

// import net.minecraft.block.BlockState;
// import net.minecraft.block.entity.BlockEntity;
// import net.minecraft.entity.player.PlayerEntity;
// import net.minecraft.entity.player.PlayerInventory;
// import net.minecraft.inventory.Inventories;
// import net.minecraft.item.ItemStack;
// import net.minecraft.nbt.NbtCompound;
// import net.minecraft.registry.RegistryWrapper;
// import net.minecraft.screen.NamedScreenHandlerFactory;
// import net.minecraft.screen.PropertyDelegate; // for syncing client + server
// import net.minecraft.screen.ScreenHandler;
// import net.minecraft.text.Text;
// import net.minecraft.util.collection.DefaultedList;
// import net.minecraft.util.math.BlockPos;

// public class MagicChestBlockEntity extends BlockEntity implements NamedScreenHandlerFactory, ImplementedInventory {
//     private final DefaultedList<ItemStack> inventory = DefaultedList.ofSize(256, ItemStack.EMPTY);

//     protected final PropertyDelegate propertyDelegate;
//     private int progress = 0;
//     private int maxProgress = 72;

//     public MagicChestBlockEntity(BlockPos pos, BlockState state) {
//         super(Keeblarcraft.MAGIC_CHEST_BLOCK_ENTITY, pos, state);
//         this.propertyDelegate = new PropertyDelegate() {

//             @Override
//             public int get(int index) {
//                 return switch(index) {
//                     case 0 -> MagicChestBlockEntity.this.progress;
//                     case 1 -> MagicChestBlockEntity.this.maxProgress;
//                     default -> 0;
//                 };
//             }

//             @Override
//             public void set(int index, int value) {
//                 switch (index) {
//                     case 0 -> MagicChestBlockEntity.this.progress = value;
//                     case 1 -> MagicChestBlockEntity.this.maxProgress = value;
//                 };
//             }

//             // MUST be size of how many integers we are synchronizing
//             @Override
//             public int size() {
//                 return 2;
//             }

//         };
//     }

//     @Override
//     public ScreenHandler createMenu(int syncId, PlayerInventory playerInventory, PlayerEntity player) {
//         // Screen handler will sync the inventory
//         return new MagicChestScreenHandler(syncId, playerInventory, this);
//     }

//     @Override
//     public DefaultedList<ItemStack> getItems() {
//         return inventory;
//     }

//     @Override
//     public Text getDisplayName() {
//         return Text.translatable(getCachedState().getBlock().getTranslationKey());
//     }

//     @Override
//     public void readNbt(NbtCompound nbt) {
//         super.readNbt(nbt);
//         Inventories.readNbt(nbt, this.inventory);
//     }

//     @Override
//     public void writeNbt(NbtCompound nbt) {
//         super.writeNbt(nbt);
//         Inventories.writeNbt(nbt, this.inventory);
//     }
// }
