Package xk.xact.recipes

Examples of xk.xact.recipes.CraftRecipe


    NBTTagList list2 = nbt.getTagList( "recipes" );
    for( int i = 0; i < list2.tagCount(); i++ ) {
      NBTTagCompound tag = (NBTTagCompound) list2.tagAt( i );
      ItemStack key = Utils.readStackFromNBT( (NBTTagCompound) tag.getTag( "key" ) );
      if( key != null ) {
        CraftRecipe recipe = CraftRecipe.readFromNBT( tag );
        recipes.put( key, recipe );
      }
    }
  }
View Full Code Here


  }

  protected void drawRecipe(ItemStack chip) {
    if( chip == null )
      return;
    CraftRecipe recipe = RecipeUtils.getRecipe( chip, this.mc.thePlayer.worldObj );
    if( recipe == null )
      return;

    ItemStack result = recipe.getResult();
    GuiUtils.paintItem( result, 32, 17, this.mc, itemRenderer );

    ItemStack[] ingredients = recipe.getIngredients();
    for( int i = 0; i < 3; i++ ) {
      for( int e = 0; e < 3; e++ ) {
        int index = i * 3 + e;
        GuiUtils.paintItem( ingredients[index], e * 18 + 14, i * 18 + 41, this.mc, itemRenderer );
      }
View Full Code Here

      if( chip == null ) {
        button.setMode( ICustomButtonMode.DeviceModes.INACTIVE );

      } else if( chip.getItem() instanceof ItemChip ) {
        if( !((ItemChip) chip.getItem()).encoded ) {
          CraftRecipe mainRecipe = craftPad.getRecipe( 0 ); // the recipe on the grid
          if( mainRecipe != null && mainRecipe.isValid() ) {
            button.setMode( ICustomButtonMode.DeviceModes.SAVE );

          } else {
            button.setMode( ICustomButtonMode.DeviceModes.INACTIVE );
          }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
    if( itemStack.getItem() instanceof ItemChip ) {
      if( ((ItemChip) itemStack.getItem()).encoded ) {
        CraftRecipe recipe = RecipeUtils.getRecipe( itemStack, player.worldObj );
        if( recipe != null ) {
          ItemStack result = recipe.getResult();

          String itemName = result.getItem().getItemDisplayName( result );
          list.add( "\u00a73" + "Recipe: " + itemName );
        } else {
          list.add( "\u00a7c<invalid>" );
View Full Code Here

  public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) {
    drawing = true;

    GL11.glEnable( GL11.GL_LIGHTING );

    CraftRecipe recipe = RecipeUtils.getRecipe( itemStack, Minecraft.getMinecraft().theWorld );
    if( recipe != null ) {
      GuiUtils.paintItem( recipe.getResult(), 0, 0, Minecraft.getMinecraft(), GuiUtils.itemRender );

      // Green overlay
      GuiUtils.paintEffectOverlay( 0, 0, GuiUtils.itemRender, 0.25f, 0.55f, 0.3f, 0.85f );
    } else {
      // paint invalid chip icon
View Full Code Here

  @Override
  public void loadUsageRecipes(ItemStack ingredient) {
    if( CraftManager.isEncoded( ingredient ) ) {

      CraftRecipe recipe = RecipeUtils.getRecipe( ingredient, FMLClientHandler.instance().getClient().theWorld );
      if( recipe != null ) {
        EncoderRecipe recipeT = new EncoderRecipe( 3, 3, recipe.getIngredients(), recipe.getResult(), ingredient );
        arecipes.add( recipeT );
      }
    }
  }
View Full Code Here

  public abstract void sendGridIngredients(ItemStack[] ingredients);

  @Override
  public void handleKeyBinding(int keyCode, String keyDescription) {
    CraftRecipe recipe;

    if( keyDescription.equals( "xact.clear" ) ) {
      setRecipe( null );

    } else if( keyDescription.equals( "xact.load" ) ) {
      Slot hoveredSlot = GuiUtils.getHoveredSlot( guiLeft, guiTop );

      if( hoveredSlot != null && hoveredSlot.getHasStack() ) {
        ItemStack stackInSlot = hoveredSlot.getStack();
        if( CraftManager.isEncoded( stackInSlot ) ) {
          recipe = RecipeUtils.getRecipe( stackInSlot, GuiUtils.getWorld() );
          if( recipe != null && recipe.isValid() ) {
            setRecipe( recipe );
          }
        }
      }
View Full Code Here

    return retValue;
  }

  public int countIngredientRequirement(ItemStack item, int amount) {
    CraftRecipe recipe = getMainRecipe();
    double multiplier = amount / recipe.getResult().stackSize;
    return (int) Math.ceil( count( item, recipe, multiplier ) );
  }
View Full Code Here

    for( ItemStack ingredient : recipe.getSimplifiedIngredients() ) {
      int amount = ingredient.stackSize;
      if( InventoryUtils.similarStacks( ingredient, item, false ) ) {
        count += amount;
      } else if( list.hasRecipe( ingredient ) ) {
        CraftRecipe recipe2 = list.getRecipe( item );
        double nextMultiplier = multiplier * amount / recipe2.getResult().stackSize;

        count += count( item, recipe2, nextMultiplier );
      }
    }
    return count * multiplier;
 
View Full Code Here

    // 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

TOP

Related Classes of xk.xact.recipes.CraftRecipe

Copyright © 2018 www.massapicom. 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.