Examples of CraftRecipe


Examples of xk.xact.recipes.CraftRecipe

    // Read target item
    ItemStack item = Utils.readStackFromNBT( (NBTTagCompound) nbt.getTag( "targetItem" ) );

    // Read target recipe
    CraftRecipe recipe = CraftRecipe.readFromNBT( nbt );

    project.setTarget( item, recipe );

    // Read the list of ingredients
    project.list.readFromNBT( nbt );
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

          continue;
        }

        if( chip.getItem() instanceof ItemChip ) {
          if( !((ItemChip) chip.getItem()).encoded ) {
            CraftRecipe mainRecipe = crafter.getRecipe( 4 ); // the recipe on the grid
            if( mainRecipe != null && mainRecipe.isValid() ) {
              buttons[i].setMode( ICustomButtonMode.DeviceModes.SAVE );
              continue;
            }
            buttons[i].setMode( ICustomButtonMode.DeviceModes.INACTIVE );
            continue;
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

  private static final int TRANSPARENCY = 128 << 24; // 50%

  private void updateGhostContents(int newIndex) {
    this.hoveredRecipe = newIndex == -1 ? -1 : newIndex % 4;
    if( hoveredRecipe != -1 ) {
      CraftRecipe recipe = crafter.getRecipe( hoveredRecipe );
      gridContents = recipe == null ? emptyGrid : recipe.getIngredients();
    }
  }
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

  public void refreshIngredients() {
    // this will clear the ingredients list, and repopulate it with the ones that are still required.
    ingredients.clear();

    CraftRecipe mainRecipe = project.getMainRecipe();
    if( mainRecipe != null ) {
      for( ItemStack item : mainRecipe.getSimplifiedIngredients() ) {
        addIngredient( item );
      }
    }

    for( CraftRecipe recipe : recipes.values() ) {
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

  public ItemStack getStack() {
    return Utils.copyOf( super.getStack() );
  }

  public ItemStack getCraftedStack() {
    CraftRecipe recipe = getRecipe();
    if( recipe == null )
      return null;
    if( device.getWorld().isRemote )
      return getStack(); // Client-side, only show.
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

  @Override
  public void onPickupFromSlot(EntityPlayer player, ItemStack craftedItem) {
    if( player.capabilities.isCreativeMode || craftedItem == null )
      return;

    CraftRecipe recipe = getRecipe();
    if( recipe == null ) return;
    handler.doCraft( recipe, player, craftedItem );
  }
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

    updateIfChangesDetected();
  }

  // Gets the recipe's result.
  public ItemStack getRecipeResult(int slot) {
    CraftRecipe recipe = this.getRecipe( slot );
    return recipe == null ? null : recipe.getResult();
  }
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

  // Once the chip is taken/placed/changed, this will be called to update the current recipe.
  private void onChipChanged(Slot slot) {
    // Placing an encoded chips will replace the current recipe, by design

    if( slot.getHasStack() ) { // placed a chip
      CraftRecipe recipe = RecipeUtils.getRecipe( slot.getStack(), player.worldObj );

      if( recipe != null ) { // placed an encoded chip
        // update the crafting grid
        craftPad.gridInv.setContents( recipe.getIngredients() );

      } else { // placing a blank chip
        // Automatically clear invalid chips.
        if( CraftManager.isEncoded( slot.getStack() ) ) {
          slot.putStack( new ItemStack( XActMod.itemRecipeBlank ) );
View Full Code Here

Examples of xk.xact.recipes.CraftRecipe

    return true;
  }

  private void updateOutputSlot() {
    ItemStack[] gridContents = Arrays.copyOf( internalInventory.getContents(), 9 );
    CraftRecipe recipe = RecipeUtils.getRecipe( gridContents, player.worldObj );

    Slot outputSlot = (Slot) inventorySlots.get( 0 );
    ItemStack item = null;
    if( recipe != null ) {
      InventoryCrafting grid = InventoryUtils.simulateCraftingInventory( gridContents );
      item = recipe.getRecipePointer().getOutputFrom( grid );
    }
    outputSlot.putStack( item );

    int notify = item == null ? 1 : 0;
    // todo: notify the GuiRecipe that the recipe has changed. 0 means has recipe, 1 means no recipe. (packet 0x05)
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.