Examples of CraftRecipe


Examples of com.bergerkiller.bukkit.common.inventory.CraftRecipe

  public static CraftRecipe[] getCraftingRequirements(int itemid, int data) {
    List<CraftRecipe> poss = new ArrayList<CraftRecipe>(2);
    for (Object rec : getCraftRecipes()) {
      ItemStack item = RecipeRef.getOutput(rec);
      if (item != null && MaterialUtil.getTypeId(item) == itemid && (data == -1 || MaterialUtil.getRawData(item) == data)) {
        CraftRecipe crec = CraftRecipe.create(rec);
        if (crec != null) {
          poss.add(crec);
        }
      }
    }
View Full Code Here

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

Examples of xk.xact.recipes.CraftRecipe

  }

  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

Examples of xk.xact.recipes.CraftRecipe

      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

Examples of xk.xact.recipes.CraftRecipe

  @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

Examples of xk.xact.recipes.CraftRecipe

  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

Examples of xk.xact.recipes.CraftRecipe

  @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

Examples of xk.xact.recipes.CraftRecipe

  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

Examples of xk.xact.recipes.CraftRecipe

    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

Examples of xk.xact.recipes.CraftRecipe

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