content: package com.github.alexthe666.iceandfire.inventory;
  
  import com.github.alexthe666.iceandfire.IceAndFire;
  import com.github.alexthe666.iceandfire.entity.tile.TileEntityDragonforge;
  import net.minecraft.world.Container;
  import net.minecraft.world.SimpleContainer;
  import net.minecraft.world.entity.player.Inventory;
  import net.minecraft.world.entity.player.Player;
  import net.minecraft.world.inventory.*;
  import net.minecraft.world.item.ItemStack;
  import net.minecraft.world.level.Level;
  import org.jetbrains.annotations.NotNull;
  
  //TODO: All containers etc should be rewritten
  public class ContainerDragonForge extends AbstractContainerMenu {
  
      private final Container tileFurnace;
      public int fireType;
      protected final Level world;
  
      public ContainerDragonForge(int i, Inventory playerInventory) {
          this(i, new SimpleContainer(3), playerInventory, new SimpleContainerData(0));
      }
  
  
      public ContainerDragonForge(int id, Container furnaceInventory, Inventory playerInventory, ContainerData vars) {
          super(IafContainerRegistry.DRAGON_FORGE_CONTAINER.get(), id);
          this.tileFurnace = furnaceInventory;
          this.world = playerInventory.player.level;
          if (furnaceInventory instanceof TileEntityDragonforge) {
              fireType = ((TileEntityDragonforge) furnaceInventory).fireType;
          } else if (IceAndFire.PROXY.getRefrencedTE() instanceof TileEntityDragonforge) {
              fireType = ((TileEntityDragonforge) IceAndFire.PROXY.getRefrencedTE()).fireType;
          }
          this.addSlot(new Slot(furnaceInventory, 0, 68, 34));
          this.addSlot(new Slot(furnaceInventory, 1, 86, 34));
          this.addSlot(new FurnaceResultSlot(playerInventory.player, furnaceInventory, 2, 148, 35));
  
          for (int i = 0; i < 3; ++i) {
              for (int j = 0; j < 9; ++j) {
                  this.addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
              }
          }
  
          for (int k = 0; k < 9; ++k) {
              this.addSlot(new Slot(playerInventory, k, 8 + k * 18, 142));
          }
      }
  
      @Override
      public boolean stillValid(@NotNull Player playerIn) {
          return this.tileFurnace.stillValid(playerIn);
      }
  
      @Override
      public @NotNull ItemStack quickMoveStack(@NotNull Player playerIn, int index) {
          ItemStack itemstack = ItemStack.EMPTY;
          Slot slot = this.slots.get(index);
  
          if (slot != null && slot.hasItem()) {
              ItemStack itemstack1 = slot.getItem();
              itemstack = itemstack1.copy();
  
              if (index == 2) {
                  if (!this.moveItemStackTo(itemstack1, 3, 39, true)) {
                      return ItemStack.EMPTY;
                  }
                  slot.onQuickCraft(itemstack1, itemstack);
              } else if (index != 1 && index != 0) {
                  if (fireType == 0) {
                      if (!this.moveItemStackTo(itemstack1, 0, 1, false)) {
                          return ItemStack.EMPTY;
                      }
                  } else if (index < 30) {
                      if (!this.moveItemStackTo(itemstack1, 30, 39, false)) {
                          return ItemStack.EMPTY;
                      }
                  } else if (index < 39 && !this.moveItemStackTo(itemstack1, 3, 30, false)) {
                      return ItemStack.EMPTY;
                  }
              } else if (!this.moveItemStackTo(itemstack1, 3, 39, false)) {
                  return ItemStack.EMPTY;
              }
  
              if (itemstack1.isEmpty()) {
                  slot.set(ItemStack.EMPTY);
              } else {
                  slot.setChanged();
              }
  
              if (itemstack1.getCount() == itemstack.getCount()) {
                  return ItemStack.EMPTY;
              }
  
              slot.onTake(playerIn, itemstack1);
          }
  
          return itemstack;
      }
  }
  