content: package com.github.alexthe666.iceandfire.entity.tile;
  
  import com.github.alexthe666.iceandfire.IceAndFire;
  import com.github.alexthe666.iceandfire.inventory.ContainerPodium;
  import com.github.alexthe666.iceandfire.item.ItemDragonEgg;
  import com.github.alexthe666.iceandfire.item.ItemMyrmexEgg;
  import com.github.alexthe666.iceandfire.message.MessageUpdatePodium;
  import net.minecraft.core.BlockPos;
  import net.minecraft.core.Direction;
  import net.minecraft.core.NonNullList;
  import net.minecraft.nbt.CompoundTag;
  import net.minecraft.network.Connection;
  import net.minecraft.network.chat.Component;
  import net.minecraft.network.chat.TranslatableComponent;
  import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
  import net.minecraft.world.ContainerHelper;
  import net.minecraft.world.WorldlyContainer;
  import net.minecraft.world.entity.player.Inventory;
  import net.minecraft.world.entity.player.Player;
  import net.minecraft.world.inventory.AbstractContainerMenu;
  import net.minecraft.world.inventory.SimpleContainerData;
  import net.minecraft.world.item.ItemStack;
  import net.minecraft.world.level.Level;
  import net.minecraft.world.level.block.entity.BaseContainerBlockEntity;
  import net.minecraft.world.level.block.state.BlockState;
  import net.minecraftforge.items.IItemHandler;
  import net.minecraftforge.items.wrapper.SidedInvWrapper;
  import org.jetbrains.annotations.NotNull;
  
  import javax.annotation.Nullable;
  
  public class TileEntityPodium extends BaseContainerBlockEntity implements WorldlyContainer {
  
      private static final int[] slotsTop = new int[]{0};
      public int ticksExisted;
      public int prevTicksExisted;
      IItemHandler handlerUp = new SidedInvWrapper(this, net.minecraft.core.Direction.UP);
      IItemHandler handlerDown = new SidedInvWrapper(this, Direction.DOWN);
      net.minecraftforge.common.util.LazyOptional<? extends IItemHandler>[] handlers = SidedInvWrapper
          .create(this, Direction.UP, Direction.DOWN);
      private NonNullList<ItemStack> stacks = NonNullList.withSize(1, ItemStack.EMPTY);
  
      public TileEntityPodium(BlockPos pos, BlockState state) {
          super(IafTileEntityRegistry.PODIUM.get(), pos, state);
      }
  
      //TODO: This must be easier to do
      public static void tick(Level level, BlockPos pos, BlockState state, TileEntityPodium entityPodium) {
          entityPodium.prevTicksExisted = entityPodium.ticksExisted;
          entityPodium.ticksExisted++;
      }
  
      @Override
      public net.minecraft.world.phys.AABB getRenderBoundingBox() {
          return new net.minecraft.world.phys.AABB(worldPosition, worldPosition.offset(1, 3, 1));
      }
  
      @Override
      public int getContainerSize() {
          return this.stacks.size();
      }
  
      @Override
      public @NotNull ItemStack getItem(int index) {
          return this.stacks.get(index);
      }
  
      @Override
      public @NotNull ItemStack removeItem(int index, int count) {
          if (!this.stacks.get(index).isEmpty()) {
              ItemStack itemstack;
  
              if (this.stacks.get(index).getCount() <= count) {
                  itemstack = this.stacks.get(index);
                  this.stacks.set(index, ItemStack.EMPTY);
                  return itemstack;
              } else {
                  itemstack = this.stacks.get(index).split(count);
  
                  if (this.stacks.get(index).isEmpty()) {
                      this.stacks.set(index, ItemStack.EMPTY);
                  }
  
                  return itemstack;
              }
          } else {
              return ItemStack.EMPTY;
          }
      }
  
      public ItemStack getStackInSlotOnClosing(int index) {
          if (!this.stacks.get(index).isEmpty()) {
              ItemStack itemstack = this.stacks.get(index);
              this.stacks.set(index, itemstack);
              return itemstack;
          } else {
              return ItemStack.EMPTY;
          }
      }
  
      @Override
      public void setItem(int index, @NotNull ItemStack stack) {
          this.stacks.set(index, stack);
  
          if (!stack.isEmpty() && stack.getCount() > this.getMaxStackSize()) {
              stack.setCount(this.getMaxStackSize());
          }
          this.saveAdditional(this.getUpdateTag());
          if (!level.isClientSide) {
              IceAndFire.sendMSGToAll(new MessageUpdatePodium(this.getBlockPos().asLong(), stacks.get(0)));
          }
      }
  
      @Override
      public void load(@NotNull CompoundTag compound) {
          super.load(compound);
          this.stacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
          ContainerHelper.loadAllItems(compound, this.stacks);
      }
  
      @Override
      public void saveAdditional(@NotNull CompoundTag compound) {
          ContainerHelper.saveAllItems(compound, this.stacks);
      }
  
      @Override
      public void startOpen(@NotNull Player player) {
      }
  
      @Override
      public void stopOpen(@NotNull Player player) {
      }
  
      @Override
      public boolean canPlaceItemThroughFace(int index, @NotNull ItemStack stack, Direction direction) {
          return index != 0 || (stack.getItem() instanceof ItemDragonEgg || stack.getItem() instanceof ItemMyrmexEgg);
      }
  
      @Override
      public int getMaxStackSize() {
          return 64;
      }
  
      @Override
      public boolean stillValid(@NotNull Player player) {
          return true;
      }
  
      @Override
      public void clearContent() {
          this.stacks.clear();
      }
  
      @Override
      public int @NotNull [] getSlotsForFace(@NotNull Direction side) {
          return slotsTop;
      }
  
      @Override
      public boolean canTakeItemThroughFace(int index, @NotNull ItemStack stack, @NotNull Direction direction) {
          return false;
      }
  
      @Override
      public boolean hasCustomName() {
          return false;
      }
  
      @Override
      public boolean canPlaceItem(int index, @NotNull ItemStack stack) {
          return false;
      }
  
      @Override
      public ClientboundBlockEntityDataPacket getUpdatePacket() {
          return ClientboundBlockEntityDataPacket.create(this);
      }
  
      @Override
      public void onDataPacket(Connection net, ClientboundBlockEntityDataPacket packet) {
          load(packet.getTag());
      }
  
      @Override
      public @NotNull CompoundTag getUpdateTag() {
          return this.saveWithFullMetadata();
      }
  
      @Override
      public @NotNull ItemStack removeItemNoUpdate(int index) {
          return ItemStack.EMPTY;
      }
  
      @Override
      public @NotNull Component getDisplayName() {
          return getDefaultName();
      }
  
      @Override
      protected @NotNull Component getDefaultName() {
          return new TranslatableComponent("block.iceandfire.podium");
      }
  
      @Override
      protected @NotNull AbstractContainerMenu createMenu(int id, @NotNull Inventory player) {
          return null;
      }
  
      @Override
      public boolean isEmpty() {
          for (int i = 0; i < this.getContainerSize(); i++) {
              if (!this.getItem(i).isEmpty())
                  return false;
          }
          return true;
      }
  
      @Override
      public <T> net.minecraftforge.common.util.@NotNull LazyOptional<T> getCapability(
          net.minecraftforge.common.capabilities.@NotNull Capability<T> capability, @Nullable Direction facing) {
          if (!this.remove && facing != null
              && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
              if (facing == Direction.DOWN)
                  return handlers[1].cast();
              else
                  return handlers[0].cast();
          }
          return super.getCapability(capability, facing);
      }
  
      @Nullable
      @Override
      public AbstractContainerMenu createMenu(int id, @NotNull Inventory playerInventory, @NotNull Player player) {
          return new ContainerPodium(id, this, playerInventory, new SimpleContainerData(0));
      }
  }
  