Пример #1
0
 private int secondarySort(int compareInt, IAEItemStack o1, IAEItemStack o2) {
   if (compareInt == 0) {
     return Platform.getItemDisplayName(o2)
         .compareToIgnoreCase(Platform.getItemDisplayName(o1));
   }
   return compareInt;
 }
  @Override
  public boolean onPartActivate(EntityPlayer p, Vec3 pos) {
    if (p.isSneaking()) {
      return false;
    }

    if (Platform.isServer()) {
      Platform.openGUI(p, this.getTileEntity(), this.side, GuiBridge.GUI_INTERFACE);
    }

    return true;
  }
 @Override
 public boolean isSlotEnabled(final int idx) {
   if (idx == 1) {
     return Platform.isServer()
         ? !this.getPatternTerminal().isCraftingRecipe()
         : !this.isCraftingMode();
   } else if (idx == 2) {
     return Platform.isServer()
         ? this.getPatternTerminal().isCraftingRecipe()
         : this.isCraftingMode();
   } else {
     return false;
   }
 }
  private void recalculatePlan() {
    this.reboot = true;

    if (this.forcePlan) {
      return;
    }

    final ItemStack is = this.inv.getStackInSlot(10);

    if (is != null && is.getItem() instanceof ItemEncodedPattern) {
      if (!Platform.isSameItem(is, this.myPattern)) {
        final World w = this.getWorldObj();
        final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
        final ICraftingPatternDetails ph = iep.getPatternForItem(is, w);

        if (ph != null && ph.isCraftable()) {
          this.progress = 0;
          this.myPattern = is;
          this.myPlan = ph;
        }
      }
    } else {
      this.progress = 0;
      this.forcePlan = false;
      this.myPlan = null;
      this.myPattern = null;
      this.pushDirection = ForgeDirection.UNKNOWN;
    }

    this.updateSleepiness();
  }
 @Override
 public IConfigManager getConfigManager() {
   if (Platform.isServer()) {
     return this.serverCM;
   }
   return this.clientCM;
 }
  @Override
  public void setInternal(IMEInventory<T> i) {
    if (this.monitor != null) {
      this.monitor.removeListener(this);
    }

    this.monitor = null;
    IItemList<T> before =
        this.getInternal() == null
            ? this.channel.createList()
            : this.getInternal()
                .getAvailableItems(new ItemListIgnoreCrafting(this.channel.createList()));

    super.setInternal(i);
    if (i instanceof IMEMonitor) {
      this.monitor = (IMEMonitor<T>) i;
    }

    IItemList<T> after =
        this.getInternal() == null
            ? this.channel.createList()
            : this.getInternal()
                .getAvailableItems(new ItemListIgnoreCrafting(this.channel.createList()));

    if (this.monitor != null) {
      this.monitor.addListener(this, this.monitor);
    }

    Platform.postListChanges(before, after, this, this.changeSource);
  }
Пример #7
0
 private void addToENet() {
   if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.IC2)) {
     IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance(IntegrationType.IC2);
     if (!this.isInIC2 && Platform.isServer() && ic2Integration != null) {
       ic2Integration.addToEnergyNet(this);
       this.isInIC2 = true;
     }
   }
 }
  @Override
  public void invalidate() {
    if (Platform.isClient()) {
      return;
    }

    AELog.info("Released Ticket " + this.ct.toString());
    ForgeChunkManager.releaseTicket(this.ct);
  }
Пример #9
0
 private void removeFromENet() {
   if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.IC2)) {
     IIC2 ic2Integration = (IIC2) IntegrationRegistry.INSTANCE.getInstance(IntegrationType.IC2);
     if (this.isInIC2 && Platform.isServer() && ic2Integration != null) {
       ic2Integration.removeFromEnergyNet(this);
       this.isInIC2 = false;
     }
   }
 }
 @Override
 public void securityBreak() {
   if (this.is.stackSize > 0) {
     List<ItemStack> items = new ArrayList<ItemStack>();
     items.add(this.is.copy());
     this.host.removePart(this.side, false);
     Platform.spawnDrops(
         this.tile.getWorldObj(), this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, items);
     this.is.stackSize = 0;
   }
 }
  @Override
  public void detectAndSendChanges() {
    super.detectAndSendChanges();
    if (Platform.isServer()) {
      if (this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe()) {
        this.setCraftingMode(this.getPatternTerminal().isCraftingRecipe());
        this.updateOrderOfOutputSlots();
      }

      this.substitute = this.patternTerminal.isSubstitution();
    }
  }
  @Override
  public void detectAndSendChanges() {
    this.verifyPermissions(SecurityPermissions.BUILD, false);

    if (Platform.isServer()) {
      this.rsMode =
          (RedstoneMode)
              this.upgradeable.getConfigManager().getSetting(Settings.REDSTONE_CONTROLLED);
    }

    this.craftProgress = this.tma.getCraftingProgress();

    this.standardDetectAndSendChanges();
  }
 @Override
 public ItemStack getDisplayStack() {
   if (Platform.isClient()) {
     final ItemStack is = super.getStack();
     if (is != null && is.getItem() instanceof ItemEncodedPattern) {
       final ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
       final ItemStack out = iep.getOutput(is);
       if (out != null) {
         return out;
       }
     }
   }
   return super.getStack();
 }
  @Override
  public void detectAndSendChanges() {
    super.detectAndSendChanges();

    if (!this.wirelessTerminalGUIObject.rangeCheck()) {
      if (Platform.isServer() && this.isContainerValid) {
        this.getPlayerInv().player.addChatMessage(PlayerMessages.OutOfRange.get());
      }

      this.isContainerValid = false;
    } else {
      this.powerMultiplier =
          AEConfig.instance.wireless_getDrainRate(this.wirelessTerminalGUIObject.getRange());
    }
  }
  @Override
  public void onSlotChange(final Slot s) {
    if (s == this.patternSlotOUT && Platform.isServer()) {
      for (final Object crafter : this.crafters) {
        final ICrafting icrafting = (ICrafting) crafter;

        for (final Object g : this.inventorySlots) {
          if (g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix) {
            final Slot sri = (Slot) g;
            icrafting.sendSlotContents(this, sri.slotNumber, sri.getStack());
          }
        }
        ((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
      }
      this.detectAndSendChanges();
    }
  }
  void initTicket() {
    if (Platform.isClient()) {
      return;
    }

    this.ct = ForgeChunkManager.requestTicket(AppEng.instance(), this.worldObj, Type.NORMAL);

    if (this.ct == null) {
      MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
      if (server != null) {
        List<EntityPlayerMP> pl = server.getConfigurationManager().playerEntityList;
        for (EntityPlayerMP p : pl) {
          p.addChatMessage(new ChatComponentText("Can't chunk load.."));
        }
      }
      return;
    }

    AELog.info("New Ticket " + this.ct.toString());
    ForgeChunkManager.forceChunk(
        this.ct, new ChunkCoordIntPair(this.xCoord >> 4, this.zCoord >> 4));
  }
  @Override
  @SideOnly(Side.CLIENT)
  public void addCheckedInformation(
      ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedTooltips) {
    final NBTTagCompound tag = itemStack.getTagCompound();
    double internalCurrentPower = 0;
    double internalMaxPower = this.getMaxEnergyCapacity();

    if (tag != null) {
      internalCurrentPower = tag.getDouble("internalCurrentPower");
    }

    final double percent = internalCurrentPower / internalMaxPower;

    toolTip.add(
        GuiText.StoredEnergy.getLocal()
            + ':'
            + MessageFormat.format(" {0,number,#} ", internalCurrentPower)
            + Platform.gui_localize(PowerUnits.AE.unlocalizedName)
            + " - "
            + MessageFormat.format(" {0,number,#.##%} ", percent));
  }
  public void queueInventory(final ICrafting c) {
    if (Platform.isServer() && c instanceof EntityPlayer && this.monitor != null) {
      try {
        PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate();
        final IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();

        for (final IAEItemStack send : monitorCache) {
          try {
            piu.appendItem(send);
          } catch (final BufferOverflowException boe) {
            NetworkHandler.instance.sendTo(piu, (EntityPlayerMP) c);

            piu = new PacketMEInventoryUpdate();
            piu.appendItem(send);
          }
        }

        NetworkHandler.instance.sendTo(piu, (EntityPlayerMP) c);
      } catch (final IOException e) {
        AELog.error(e);
      }
    }
  }
  public void craftOrGetItem(final PacketPatternSlot packetPatternSlot) {
    if (packetPatternSlot.slotItem != null && this.getCellInventory() != null) {
      final IAEItemStack out = packetPatternSlot.slotItem.copy();
      InventoryAdaptor inv = new AdaptorPlayerHand(this.getPlayerInv().player);
      final InventoryAdaptor playerInv =
          InventoryAdaptor.getAdaptor(this.getPlayerInv().player, ForgeDirection.UNKNOWN);

      if (packetPatternSlot.shift) {
        inv = playerInv;
      }

      if (inv.simulateAdd(out.getItemStack()) != null) {
        return;
      }

      final IAEItemStack extracted =
          Platform.poweredExtraction(
              this.getPowerSource(), this.getCellInventory(), out, this.getActionSource());
      final EntityPlayer p = this.getPlayerInv().player;

      if (extracted != null) {
        inv.addItems(extracted.getItemStack());
        if (p instanceof EntityPlayerMP) {
          this.updateHeld((EntityPlayerMP) p);
        }
        this.detectAndSendChanges();
        return;
      }

      final InventoryCrafting ic = new InventoryCrafting(new ContainerNull(), 3, 3);
      final InventoryCrafting real = new InventoryCrafting(new ContainerNull(), 3, 3);

      for (int x = 0; x < 9; x++) {
        ic.setInventorySlotContents(
            x,
            packetPatternSlot.pattern[x] == null
                ? null
                : packetPatternSlot.pattern[x].getItemStack());
      }

      final IRecipe r = Platform.findMatchingRecipe(ic, p.worldObj);

      if (r == null) {
        return;
      }

      final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal().getItemInventory();
      final IItemList<IAEItemStack> all = storage.getStorageList();

      final ItemStack is = r.getCraftingResult(ic);

      for (int x = 0; x < ic.getSizeInventory(); x++) {
        if (ic.getStackInSlot(x) != null) {
          final ItemStack pulled =
              Platform.extractItemsByRecipe(
                  this.getPowerSource(),
                  this.getActionSource(),
                  storage,
                  p.worldObj,
                  r,
                  is,
                  ic,
                  ic.getStackInSlot(x),
                  x,
                  all,
                  Actionable.MODULATE,
                  ItemViewCell.createFilter(this.getViewCells()));
          real.setInventorySlotContents(x, pulled);
        }
      }

      final IRecipe rr = Platform.findMatchingRecipe(real, p.worldObj);

      if (rr == r && Platform.isSameItemPrecise(rr.getCraftingResult(real), is)) {
        final SlotCrafting sc = new SlotCrafting(p, real, this.cOut, 0, 0, 0);
        sc.onPickupFromSlot(p, is);

        for (int x = 0; x < real.getSizeInventory(); x++) {
          final ItemStack failed = playerInv.addItems(real.getStackInSlot(x));

          if (failed != null) {
            p.dropPlayerItemWithRandomChoice(failed, false);
          }
        }

        inv.addItems(is);
        if (p instanceof EntityPlayerMP) {
          this.updateHeld((EntityPlayerMP) p);
        }
        this.detectAndSendChanges();
      } else {
        for (int x = 0; x < real.getSizeInventory(); x++) {
          final ItemStack failed = real.getStackInSlot(x);
          if (failed != null) {
            this.getCellInventory()
                .injectItems(
                    AEItemStack.create(failed),
                    Actionable.MODULATE,
                    new MachineSource(this.getPatternTerminal()));
          }
        }
      }
    }
  }
Пример #20
0
 @Override
 public void fillWithRain(final World w, final int x, final int y, final int z) {
   if (Platform.isServer()) {
     w.setBlock(x, y, z, Platform.AIR_BLOCK, 0, 3);
   }
 }
  protected ContainerMEMonitorable(
      final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
    super(
        ip,
        monitorable instanceof TileEntity ? (TileEntity) monitorable : null,
        monitorable instanceof IPart ? (IPart) monitorable : null);

    this.host = monitorable;
    this.clientCM = new ConfigManager(this);

    this.clientCM.registerSetting(Settings.SORT_BY, SortOrder.NAME);
    this.clientCM.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
    this.clientCM.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);

    if (Platform.isServer()) {
      this.serverCM = monitorable.getConfigManager();

      this.monitor = monitorable.getItemInventory();
      if (this.monitor != null) {
        this.monitor.addListener(this, null);

        this.cellInv = this.monitor;

        if (monitorable instanceof IPortableCell) {
          this.powerSrc = (IEnergySource) monitorable;
        } else if (monitorable instanceof IMEChest) {
          this.powerSrc = (IEnergySource) monitorable;
        } else if (monitorable instanceof IGridHost) {
          final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
          if (node != null) {
            this.networkNode = node;
            final IGrid g = node.getGrid();
            if (g != null) {
              this.powerSrc =
                  new ChannelPowerSrc(
                      this.networkNode, (IEnergySource) g.getCache(IEnergyGrid.class));
            }
          }
        }
      } else {
        this.isContainerValid = false;
      }
    } else {
      this.monitor = null;
    }

    this.canAccessViewCells = false;
    if (monitorable instanceof IViewCellStorage) {
      for (int y = 0; y < 5; y++) {
        this.cellView[y] =
            new SlotRestrictedInput(
                SlotRestrictedInput.PlacableItemType.VIEW_CELL,
                ((IViewCellStorage) monitorable).getViewCellStorage(),
                y,
                206,
                y * 18 + 8,
                this.invPlayer);
        this.cellView[y].allowEdit = this.canAccessViewCells;
        this.addSlotToContainer(this.cellView[y]);
      }
    }

    if (bindInventory) {
      this.bindPlayerInventory(ip, 0, 0);
    }
  }
 private void setInternal(ItemStack is, double amt) {
   final NBTTagCompound nbt = Platform.openNbtData(is);
   nbt.setDouble("internalCurrentPower", amt);
 }
  @Override
  public void detectAndSendChanges() {
    if (Platform.isServer()) {
      if (this.monitor != this.host.getItemInventory()) {
        this.isContainerValid = false;
      }

      for (final Settings set : this.serverCM.getSettings()) {
        final Enum<?> sideLocal = this.serverCM.getSetting(set);
        final Enum<?> sideRemote = this.clientCM.getSetting(set);

        if (sideLocal != sideRemote) {
          this.clientCM.putSetting(set, sideLocal);
          for (final Object crafter : this.crafters) {
            try {
              NetworkHandler.instance.sendTo(
                  new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter);
            } catch (final IOException e) {
              AELog.error(e);
            }
          }
        }
      }

      if (!this.items.isEmpty()) {
        try {
          final IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();

          final PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate();

          for (final IAEItemStack is : this.items) {
            final IAEItemStack send = monitorCache.findPrecise(is);
            if (send == null) {
              is.setStackSize(0);
              piu.appendItem(is);
            } else {
              piu.appendItem(send);
            }
          }

          if (!piu.isEmpty()) {
            this.items.resetStatus();

            for (final Object c : this.crafters) {
              if (c instanceof EntityPlayer) {
                NetworkHandler.instance.sendTo(piu, (EntityPlayerMP) c);
              }
            }
          }
        } catch (final IOException e) {
          AELog.error(e);
        }
      }

      this.updatePowerStatus();

      final boolean oldAccessible = this.canAccessViewCells;
      this.canAccessViewCells = this.hasAccess(SecurityPermissions.BUILD, false);
      if (this.canAccessViewCells != oldAccessible) {
        for (int y = 0; y < 5; y++) {
          if (this.cellView[y] != null) {
            this.cellView[y].allowEdit = this.canAccessViewCells;
          }
        }
      }

      super.detectAndSendChanges();
    }
  }
 @Override
 public void markDirty() {
   this.writeToNBT(Platform.openNbtData(this.is), "upgrades");
 }
 public CellUpgrades(final ItemStack is, final int upgrades) {
   super(is, null, upgrades);
   this.is = is;
   this.readFromNBT(Platform.openNbtData(is), "upgrades");
 }
 private double getInternal(ItemStack is) {
   final NBTTagCompound nbt = Platform.openNbtData(is);
   return nbt.getDouble("internalCurrentPower");
 }
  @Override
  public TickRateModulation tickingRequest(final IGridNode node, int ticksSinceLastCall) {
    if (this.inv.getStackInSlot(9) != null) {
      this.pushOut(this.inv.getStackInSlot(9));

      // did it eject?
      if (this.inv.getStackInSlot(9) == null) {
        this.markDirty();
      }

      this.ejectHeldItems();
      this.updateSleepiness();
      this.progress = 0;
      return this.isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
    }

    if (this.myPlan == null) {
      this.updateSleepiness();
      return TickRateModulation.SLEEP;
    }

    if (this.reboot) {
      ticksSinceLastCall = 1;
    }

    if (!this.isAwake) {
      return TickRateModulation.SLEEP;
    }

    this.reboot = false;
    int speed = 10;
    switch (this.upgrades.getInstalledUpgrades(Upgrades.SPEED)) {
      case 0:
        this.progress += this.userPower(ticksSinceLastCall, speed = 10, 1.0);
        break;
      case 1:
        this.progress += this.userPower(ticksSinceLastCall, speed = 13, 1.3);
        break;
      case 2:
        this.progress += this.userPower(ticksSinceLastCall, speed = 17, 1.7);
        break;
      case 3:
        this.progress += this.userPower(ticksSinceLastCall, speed = 20, 2.0);
        break;
      case 4:
        this.progress += this.userPower(ticksSinceLastCall, speed = 25, 2.5);
        break;
      case 5:
        this.progress += this.userPower(ticksSinceLastCall, speed = 50, 5.0);
        break;
    }

    if (this.progress >= 100) {
      for (int x = 0; x < this.craftingInv.getSizeInventory(); x++) {
        this.craftingInv.setInventorySlotContents(x, this.inv.getStackInSlot(x));
      }

      this.progress = 0;
      final ItemStack output = this.myPlan.getOutput(this.craftingInv, this.getWorldObj());
      if (output != null) {
        FMLCommonHandler.instance()
            .firePlayerCraftingEvent(
                Platform.getPlayer((WorldServer) this.getWorldObj()), output, this.craftingInv);

        this.pushOut(output.copy());

        for (int x = 0; x < this.craftingInv.getSizeInventory(); x++) {
          this.inv.setInventorySlotContents(
              x, Platform.getContainerItem(this.craftingInv.getStackInSlot(x)));
        }

        if (this.inv.getStackInSlot(10) == null) {
          this.forcePlan = false;
          this.myPlan = null;
          this.pushDirection = ForgeDirection.UNKNOWN;
        }

        this.ejectHeldItems();

        try {
          final TargetPoint where =
              new TargetPoint(
                  this.worldObj.provider.dimensionId, this.xCoord, this.yCoord, this.zCoord, 32);
          final IAEItemStack item = AEItemStack.create(output);
          NetworkHandler.instance.sendToAllAround(
              new PacketAssemblerAnimation(
                  this.xCoord, this.yCoord, this.zCoord, (byte) speed, item),
              where);
        } catch (final IOException e) {
          // ;P
        }

        this.markDirty();
        this.updateSleepiness();
        return this.isAwake ? TickRateModulation.IDLE : TickRateModulation.SLEEP;
      }
    }

    return TickRateModulation.FASTER;
  }
  @Override
  public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
    EntityPlayerMP pmp = (EntityPlayerMP) player;
    Container con = pmp.openContainer;

    if (con instanceof IContainerCraftingPacket) {
      IContainerCraftingPacket cct = (IContainerCraftingPacket) con;
      IGridNode node = cct.getNetworkNode();
      if (node != null) {
        IGrid grid = node.getGrid();
        if (grid == null) {
          return;
        }

        IStorageGrid inv = grid.getCache(IStorageGrid.class);
        IEnergyGrid energy = grid.getCache(IEnergyGrid.class);
        ISecurityGrid security = grid.getCache(ISecurityGrid.class);
        IInventory craftMatrix = cct.getInventoryByName("crafting");
        IInventory playerInventory = cct.getInventoryByName("player");

        Actionable realForFake = cct.useRealItems() ? Actionable.MODULATE : Actionable.SIMULATE;

        if (inv != null && this.recipe != null && security != null) {
          InventoryCrafting testInv = new InventoryCrafting(new ContainerNull(), 3, 3);
          for (int x = 0; x < 9; x++) {
            if (this.recipe[x] != null && this.recipe[x].length > 0) {
              testInv.setInventorySlotContents(x, this.recipe[x][0]);
            }
          }

          IRecipe r = Platform.findMatchingRecipe(testInv, pmp.worldObj);

          if (r != null && security.hasPermission(player, SecurityPermissions.EXTRACT)) {
            ItemStack is = r.getCraftingResult(testInv);

            if (is != null) {
              IMEMonitor<IAEItemStack> storage = inv.getItemInventory();
              IItemList all = storage.getStorageList();
              IPartitionList<IAEItemStack> filter = ItemViewCell.createFilter(cct.getViewCells());

              for (int x = 0; x < craftMatrix.getSizeInventory(); x++) {
                ItemStack patternItem = testInv.getStackInSlot(x);

                ItemStack currentItem = craftMatrix.getStackInSlot(x);
                if (currentItem != null) {
                  testInv.setInventorySlotContents(x, currentItem);
                  ItemStack newItemStack =
                      r.matches(testInv, pmp.worldObj) ? r.getCraftingResult(testInv) : null;
                  testInv.setInventorySlotContents(x, patternItem);

                  if (newItemStack == null || !Platform.isSameItemPrecise(newItemStack, is)) {
                    IAEItemStack in = AEItemStack.create(currentItem);
                    if (in != null) {
                      IAEItemStack out =
                          realForFake == Actionable.SIMULATE
                              ? null
                              : Platform.poweredInsert(energy, storage, in, cct.getSource());
                      if (out != null) {
                        craftMatrix.setInventorySlotContents(x, out.getItemStack());
                      } else {
                        craftMatrix.setInventorySlotContents(x, null);
                      }

                      currentItem = craftMatrix.getStackInSlot(x);
                    }
                  }
                }

                // True if we need to fetch an item for the recipe
                if (patternItem != null && currentItem == null) {
                  // Grab from network by recipe
                  ItemStack whichItem =
                      Platform.extractItemsByRecipe(
                          energy,
                          cct.getSource(),
                          storage,
                          player.worldObj,
                          r,
                          is,
                          testInv,
                          patternItem,
                          x,
                          all,
                          realForFake,
                          filter);

                  // If that doesn't get it, grab exact items from network (?)
                  // TODO see if this code is necessary
                  if (whichItem == null) {
                    for (int y = 0; y < this.recipe[x].length; y++) {
                      IAEItemStack request = AEItemStack.create(this.recipe[x][y]);
                      if (request != null) {
                        if (filter == null || filter.isListed(request)) {
                          request.setStackSize(1);
                          IAEItemStack out =
                              Platform.poweredExtraction(energy, storage, request, cct.getSource());
                          if (out != null) {
                            whichItem = out.getItemStack();
                            break;
                          }
                        }
                      }
                    }
                  }

                  // If that doesn't work, grab from the player's inventory
                  if (whichItem == null && playerInventory != null) {
                    whichItem = extractItemFromPlayerInventory(player, realForFake, patternItem);
                  }

                  craftMatrix.setInventorySlotContents(x, whichItem);
                }
              }
              con.onCraftMatrixChanged(craftMatrix);
            }
          }
        }
      }
    }
  }