Examples of ICraftingPatternDetails


Examples of appeng.api.networking.crafting.ICraftingPatternDetails

    if ( is.getItem() instanceof ItemEncodedPattern )
    {
      World w = this.getTileEntity().getWorldObj();
      ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem();
      ICraftingPatternDetails ph = iep.getPatternForItem( is, w );
      if ( ph.isCraftable() )
        return ph.isValidItemForSlot( slotIndex, i, w );
    }

    return false;
  }
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

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

        if ( ph != null && ph.isCraftable() )
        {
          progress = 0;
          myPattern = is;
          myPlan = ph;
        }
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

      if ( myPat != null && myPat.getItem() instanceof ItemEncodedPattern )
      {
        World w = getWorldObj();
        ItemEncodedPattern iep = (ItemEncodedPattern) myPat.getItem();
        ICraftingPatternDetails ph = iep.getPatternForItem( myPat, w );
        if ( ph != null && ph.isCraftable() )
        {
          forcePlan = true;
          myPlan = ph;
          pushDirection = ForgeDirection.getOrientation( data.getInteger( "pushDirection" ) );
        }
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

    {
    case ENCODED_CRAFTING_PATTERN:
      if ( i.getItem() instanceof ICraftingPatternItem )
      {
        ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
        ICraftingPatternDetails de = b.getPatternForItem( i, p.player.worldObj );
        if ( de != null )
          return de.isCraftable();
      }
      return false;
    case VALID_ENCODED_PATTERN_W_OUTPUT:
    case ENCODED_PATTERN_W_OUTPUT:
    case ENCODED_PATTERN: {
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

    if ( craftingList != null )
    {
      Iterator<ICraftingPatternDetails> i = craftingList.iterator();
      while (i.hasNext())
      {
        ICraftingPatternDetails details = i.next();
        boolean found = false;

        for (int x = 0; x < accountedFor.length; x++)
        {
          ItemStack is = patterns.getStackInSlot( x );
          if ( details.getPattern() == is )
          {
            accountedFor[x] = found = true;
          }
        }
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

      return;

    if ( is.getItem() instanceof ICraftingPatternItem )
    {
      ICraftingPatternItem cpi = (ICraftingPatternItem) is.getItem();
      ICraftingPatternDetails details = cpi.getPatternForItem( is, iHost.getTileEntity().getWorldObj() );

      if ( details != null )
      {
        if ( craftingList == null )
          craftingList = new LinkedList<ICraftingPatternDetails>();
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

      {
        i.remove();
        continue;
      }

      ICraftingPatternDetails details = e.getKey();
      if ( canCraft( details, details.getCondensedInputs() ) )
      {
        InventoryCrafting ic = null;

        for (ICraftingMedium m : cc.getMediums( e.getKey() ))
        {
          if ( e.getValue().value <= 0 )
            continue;

          if ( !m.isBusy() )
          {
            if ( ic == null )
            {
              IAEItemStack[] input = details.getInputs();

              double sum = 0;
              for (IAEItemStack anInput : input)
              {
                if ( anInput != null )
                {
                  sum += anInput.getStackSize();
                }
              }

              // power...
              if ( eg.extractAEPower( sum, Actionable.MODULATE, PowerMultiplier.CONFIG ) < sum - 0.01 )
                continue;

              ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
              boolean found = false;

              for (int x = 0; x < input.length; x++)
              {

                if ( input[x] != null )
                {
                  found = false;
                  if ( details.isCraftable() )
                  {
                    for (IAEItemStack fuzz : inventory.getItemList().findFuzzy( input[x], FuzzyMode.IGNORE_ALL ))
                    {
                      fuzz = fuzz.copy();
                      fuzz.setStackSize( input[x].getStackSize() );

                      if ( details.isValidItemForSlot( x, fuzz.getItemStack(), getWorld() ) )
                      {
                        IAEItemStack ais = inventory.extractItems( fuzz, Actionable.MODULATE, machineSrc );
                        ItemStack is = ais == null ? null : ais.getItemStack();

                        if ( is != null )
                        {
                          postChange( AEItemStack.create( is ), machineSrc );
                          ic.setInventorySlotContents( x, is );
                          found = true;
                          break;
                        }
                      }
                    }
                  }
                  else
                  {
                    IAEItemStack ais = inventory.extractItems( input[x].copy(), Actionable.MODULATE, machineSrc );
                    ItemStack is = ais == null ? null : ais.getItemStack();

                    if ( is != null )
                    {
                      postChange( input[x], machineSrc );
                      ic.setInventorySlotContents( x, is );
                      if ( is.stackSize == input[x].getStackSize() )
                      {
                        found = true;
                        continue;
                      }
                    }
                  }

                  if ( !found )
                    break;
                }

              }

              if ( !found )
              {
                // put stuff back..
                for (int x = 0; x < ic.getSizeInventory(); x++)
                {
                  ItemStack is = ic.getStackInSlot( x );
                  if ( is != null )
                    inventory.injectItems( AEItemStack.create( is ), Actionable.MODULATE, machineSrc );
                }
                ic = null;
                break;
              }
            }

            if ( m.pushPattern( details, ic ) )
            {
              somethingChanged = true;
              remainingOperations--;

              for (IAEItemStack out : details.getCondensedOutputs())
              {
                postChange( out, machineSrc );
                waitingFor.add( out.copy() );
                postCraftingStatusChange( out.copy() );
              }

              if ( details.isCraftable() )
              {
                FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) getWorld() ),
                    details.getOutput( ic, getWorld() ), ic );

                for (int x = 0; x < ic.getSizeInventory(); x++)
                {
                  ItemStack output = Platform.getContainerItem( ic.getStackInSlot( x ) );
                  if ( output != null )
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

      NBTTagCompound item = list.getCompoundTagAt( x );
      IAEItemStack pattern = AEItemStack.loadItemStackFromNBT( item );
      if ( pattern != null && pattern.getItem() instanceof ICraftingPatternItem )
      {
        ICraftingPatternItem cpi = (ICraftingPatternItem) pattern.getItem();
        ICraftingPatternDetails details = cpi.getPatternForItem( pattern.getItemStack(), getWorld() );
        if ( details != null )
        {
          TaskProgress tp = new TaskProgress();
          tp.value = item.getLong( "craftingProgress" );
          tasks.put( details, tp );
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

    {
      ItemStack is = pattern.getStackInSlot( 1 );
      if ( is != null && is.getItem() instanceof ICraftingPatternItem )
      {
        ICraftingPatternItem pattern = (ICraftingPatternItem) is.getItem();
        ICraftingPatternDetails details = pattern.getPatternForItem( is, this.getHost().getTile().getWorldObj() );
        if ( details != null )
        {
          setCraftingRecipe( details.isCraftable() );

          for (int x = 0; x < crafting.getSizeInventory() && x < details.getInputs().length; x++)
          {
            IAEItemStack item = details.getInputs()[x];
            crafting.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
          }

          for (int x = 0; x < output.getSizeInventory() && x < details.getOutputs().length; x++)
          {
            IAEItemStack item = details.getOutputs()[x];
            output.setInventorySlotContents( x, item == null ? null : item.getItemStack() );
          }
        }
      }
    }
View Full Code Here

Examples of appeng.api.networking.crafting.ICraftingPatternDetails

  public boolean isValid(ItemStack is, World theWorld)
  {
    if ( which == PlacableItemType.VALID_ENCODED_PATTERN_W_OUTPUT )
    {
      ICraftingPatternDetails ap = is.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) is.getItem()).getPatternForItem( is, theWorld )
          : null;
      if ( ap != null )
        return true;
      return false;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.