net.minecraft.item.crafting.FurnaceRecipes Java Examples
The following examples show how to use
net.minecraft.item.crafting.FurnaceRecipes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SemiBlockHeatFrame.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
private boolean tryCookSlot(IInventory inv, int slot){ ItemStack stack = inv.getStackInSlot(slot); if(stack != null) { ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(stack); if(result != null) { ItemStack remainder = IOHelper.insert(getTileEntity(), result, true); if(remainder == null) { IOHelper.insert(getTileEntity(), result, false); inv.decrStackSize(slot, 1); lastValidSlot = slot; return true; } } } return false; }
Example #2
Source File: MachineManager.java From customstuff4 with GNU General Public License v3.0 | 6 votes |
public static boolean isPartOfRecipe(ResourceLocation list, ItemStack stack) { if (stack.isEmpty()) return false; if (list.toString().equals("minecraft:vanilla")) { return !FurnaceRecipes.instance().getSmeltingResult(stack).isEmpty(); } for (MachineRecipe recipe : getInstance(list).recipes) { if (recipe.getRecipeInput().stream() .anyMatch(input -> ItemHelper.stackMatchesRecipeInput(stack, input, false))) return true; } return false; }
Example #3
Source File: RecipeIterator.java From Kettle with GNU General Public License v3.0 | 6 votes |
public Recipe next() { if (recipes.hasNext()) { removeFrom = recipes; IRecipe recipe = recipes.next(); if (recipe instanceof ShapedRecipe || recipe instanceof ShapelessRecipe) { return recipe.toBukkitRecipe(); } else { return new CraftCustomModRecipe(recipe); } } else { net.minecraft.item.ItemStack item; if (smeltingCustom.hasNext()) { removeFrom = smeltingCustom; item = smeltingCustom.next(); } else { removeFrom = smeltingVanilla; item = smeltingVanilla.next(); } CraftItemStack stack = CraftItemStack.asCraftMirror(FurnaceRecipes.instance().getSmeltingResult(item)); return new CraftFurnaceRecipe(stack, CraftItemStack.asCraftMirror(item)); } }
Example #4
Source File: TileEntityCreationStation.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
/** * Updates the cached smelting result for the current input item, if the input has changed since last caching the result. */ private void updateSmeltingResult(int id) { if (this.inputDirty[id]) { ItemStack inputStack = this.furnaceInventory.getStackInSlot(id * 3); if (inputStack.isEmpty() == false) { this.smeltingResultCache[id] = FurnaceRecipes.instance().getSmeltingResult(inputStack); } else { this.smeltingResultCache[id] = ItemStack.EMPTY; } this.inputDirty[id] = false; } }
Example #5
Source File: TileEntityEnderFurnace.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
/** * Updates the cached smelting result for the current input item, if the input has changed since last caching the result. */ private void updateSmeltingResult() { if (this.inputDirty) { if (this.getBaseItemHandler().getStackInSlot(SLOT_INPUT).isEmpty() == false) { this.smeltingResultCache = FurnaceRecipes.instance().getSmeltingResult(this.getBaseItemHandler().getStackInSlot(SLOT_INPUT)); } else { this.smeltingResultCache = ItemStack.EMPTY; } this.inputDirty = false; } }
Example #6
Source File: ModHandler.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
/** * Removes a Smelting Recipe */ public static boolean removeFurnaceSmelting(ItemStack input) { if (input.isEmpty()) { GTLog.logger.error("Cannot remove furnace recipe with empty input."); GTLog.logger.error("Stacktrace:", new IllegalArgumentException()); RecipeMap.setFoundInvalidRecipe(true); return false; } for (ItemStack stack : FurnaceRecipes.instance().getSmeltingList().keySet()) { if (ItemStack.areItemStacksEqual(input, stack)) { FurnaceRecipes.instance().getSmeltingList().remove(stack); return true; } } return false; }
Example #7
Source File: ModHandler.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
/** * Just simple Furnace smelting */ public static void addSmeltingRecipe(ItemStack input, ItemStack output) { boolean skip = false; if (input.isEmpty()) { GTLog.logger.error("Input cannot be an empty ItemStack", new IllegalArgumentException()); skip = true; RecipeMap.setFoundInvalidRecipe(true); } if (output.isEmpty()) { GTLog.logger.error("Output cannot be an empty ItemStack", new IllegalArgumentException()); skip = true; RecipeMap.setFoundInvalidRecipe(true); } if (skip) return; FurnaceRecipes recipes = FurnaceRecipes.instance(); if (recipes.getSmeltingResult(input).isEmpty()) { //register only if there is no recipe with duplicate input recipes.addSmeltingRecipe(input, output, 0.0f); } }
Example #8
Source File: RecipeBuilder.java From EmergingTechnology with MIT License | 6 votes |
private static void registerFurnaceRecipes() { FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModBlocks.plasticblock), new ItemStack(ModItems.filament), 0.1f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.shreddedplant), new ItemStack(ModItems.biomass), 0.1f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.shreddedstarch), new ItemStack(ModItems.biomass), 0.1f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.algae), new ItemStack(ModItems.biomass), 0.1f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.syntheticchickenraw), new ItemStack(ModItems.syntheticchickencooked), 0.2f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.syntheticcowraw), new ItemStack(ModItems.syntheticcowcooked), 0.2f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.syntheticpigraw), new ItemStack(ModItems.syntheticpigcooked), 0.2f); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ModItems.algaebarraw), new ItemStack(ModItems.algaebarcooked), 0.2f); }
Example #9
Source File: TileEntityEtherealMacerator.java From Electro-Magic-Tools with GNU General Public License v3.0 | 6 votes |
public void smeltItem() { if (this.canSmelt()) { ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); if (this.slots[2] == null) { this.slots[2] = itemstack.copy(); this.slots[2].stackSize *= 2; } else if (this.slots[2].isItemEqual(itemstack)) { slots[2].stackSize += (itemstack.stackSize * 2); } --this.slots[0].stackSize; if (this.slots[0].stackSize <= 0) { this.slots[0] = null; } this.addBonus(); } }
Example #10
Source File: UpgradeFurnace.java From BetterChests with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void update(IUpgradableBlock chest, ItemStack stack) { if (UpgradeHelper.INSTANCE.getFrequencyTick(chest, stack, 16) != 0 || !hasUpgradeOperationCost(chest) || chest.getWorldObj().isRemote) { return; } IBetterChest inv = (IBetterChest) chest; IFilter filter = inv.getFilterFor(stack); int toSmeltSlot = InvUtil.findInInv(inv, true, false, null, test -> !FurnaceRecipes.instance().getSmeltingResult(test).isEmpty() && filter.matchesStack(test)); if (toSmeltSlot != -1) { ItemStack target = inv.getStackInSlot(toSmeltSlot); ItemStack result = FurnaceRecipes.instance().getSmeltingResult(target); if (InvUtil.putStackInInventory(result, inv, true, false, true, null).isEmpty()) { InvUtil.putStackInInventory(result, inv, true, false, false, null); inv.decrStackSize(toSmeltSlot, 1); drawUpgradeOperationCode(chest); inv.markDirty(); } } }
Example #11
Source File: SakuraRecipeRegister.java From Sakura_mod with MIT License | 6 votes |
public static void furnaceRegister() { FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.IRON_SAND), new ItemStack(Items.IRON_INGOT), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 1), new ItemStack(ItemLoader.MATERIAL, 1, 38), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 21), new ItemStack(ItemLoader.MATERIAL, 1, 22), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.EGGPLANT, 1), new ItemStack(ItemLoader.FOODSET, 1, 87), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 17), new ItemStack(ItemLoader.FOODSET, 1, 2), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 15), new ItemStack(ItemLoader.MATERIAL, 1, 31), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 7), new ItemStack(ItemLoader.FOODSET, 1, 131), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.FOODSET, 1, 48), new ItemStack(ItemLoader.FOODSET, 1, 49), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.FOODSET, 1, 58), new ItemStack(ItemLoader.FOODSET, 1, 59), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 6), new ItemStack(ItemLoader.FOODSET, 1, 4), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.FOODSET, 1, 112), new ItemStack(ItemLoader.FOODSET, 1, 113), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ItemLoader.MATERIAL, 1, 31), new ItemStack(ItemLoader.FOODSET, 1, 73), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.MAPLE_LOG, 1), new ItemStack(Items.COAL, 1, 1), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.SAKURA_LOG, 1), new ItemStack(Items.COAL, 1, 1), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.BAMBOO_BLOCK, 1), new ItemStack(BlockLoader.BAMBOO_CHARCOAL_BLOCK), 0.1F); FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(BlockLoader.BAMBOO, 1), new ItemStack(ItemLoader.MATERIAL, 1, 51), 0.1F); if(SakuraConfig.harder_iron_recipe) FurnaceRecipes.instance().getSmeltingList().forEach((key,value) ->{ if(RecipesUtil.containsMatch(false, OreDictionary.getOres("ingotIron"), value)) FurnaceRecipes.instance().getSmeltingList().put(key, new ItemStack(ItemLoader.MATERIAL,1,52)); }); }
Example #12
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public void loadUsageRecipes(ItemStack ingredient) { Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.instance().getSmeltingList(); for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) if (NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey(), ingredient)) { SmeltingPair arecipe = new SmeltingPair(recipe.getKey(), recipe.getValue()); arecipe.setIngredientPermutation(Arrays.asList(arecipe.ingred), ingredient); arecipes.add(arecipe); } }
Example #13
Source File: MinecraftRecipeRegistry.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
private void onNOVASmeltingAdded(RecipeEvent.Add<SmeltingRecipe> evt) { SmeltingRecipe recipe = evt.recipe; Collection<Item> inputs = recipe.getInput().map(ItemIngredient::getExampleItems).orElse(Collections.emptyList()); final Optional<ItemStack> output = recipe.getExampleOutput().map(ItemConverter.instance()::toNative); if (!output.isPresent()) return; inputs.stream().map(ItemConverter.instance()::toNative).forEach(input -> FurnaceRecipes.instance().addSmeltingRecipe(input, output.get(), 0)); }
Example #14
Source File: MinecraftRecipeRegistry.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
private void onNOVASmeltingRemoved(RecipeEvent.Remove<SmeltingRecipe> evt) { SmeltingRecipe recipe = evt.recipe; Collection<Item> inputs = recipe.getInput().map(ItemIngredient::getExampleItems).orElse(Collections.emptyList()); @SuppressWarnings("unchecked") Map<ItemStack, ItemStack> smeltingList = FurnaceRecipes.instance().getSmeltingList(); inputs.stream().map(ItemConverter.instance()::toNative).forEach(input -> smeltingList.remove(input)); }
Example #15
Source File: TileEntityTFOven.java From TofuCraftReload with MIT License | 5 votes |
@Override public boolean canWork() { if (energy >= POWER) { //If energy is suitable if (((ItemStack) this.inventory.get(0)).isEmpty()) { return false; } else { ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.inventory.get(0)); if (itemstack.isEmpty()) { return false; } else { ItemStack itemstack1 = this.inventory.get(1); if (itemstack1.isEmpty()) { return true; } else if (!itemstack1.isItemEqual(itemstack)) { return false; } else if (itemstack1.getCount() + itemstack.getCount() <= this.getInventoryStackLimit() && itemstack1.getCount() + itemstack.getCount() <= itemstack1.getMaxStackSize()) // Forge fix: make furnace respect stack sizes in furnace recipes { return true; } else { return itemstack1.getCount() + itemstack.getCount() <= itemstack.getMaxStackSize(); // Forge fix: make furnace respect stack sizes in furnace recipes } } } } return false; }
Example #16
Source File: MinecraftRecipeRegistry.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
private void onNOVASmeltingRemoved(RecipeEvent.Remove<SmeltingRecipe> evt) { SmeltingRecipe recipe = evt.recipe; Collection<Item> inputs = recipe.getInput().map(ItemIngredient::getExampleItems).orElse(Collections.emptyList()); @SuppressWarnings("unchecked") Map<ItemStack, ItemStack> smeltingList = FurnaceRecipes.instance().getSmeltingList(); inputs.stream().map(ItemConverter.instance()::toNative).forEach(input -> smeltingList.remove(input)); }
Example #17
Source File: MinecraftRecipeRegistry.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
private void onNOVASmeltingAdded(RecipeEvent.Add<SmeltingRecipe> evt) { SmeltingRecipe recipe = evt.recipe; Collection<Item> inputs = recipe.getInput().map(ItemIngredient::getExampleItems).orElse(Collections.emptyList()); final Optional<ItemStack> output = recipe.getExampleOutput().map(ItemConverter.instance()::toNative); if (!output.isPresent()) return; inputs.stream().map(ItemConverter.instance()::toNative).forEach(input -> FurnaceRecipes.smelting().func_151394_a(input, output.get(), 0)); }
Example #18
Source File: MinecraftRecipeRegistry.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
private void onNOVASmeltingRemoved(RecipeEvent.Remove<SmeltingRecipe> evt) { SmeltingRecipe recipe = evt.recipe; Collection<Item> inputs = recipe.getInput().map(ItemIngredient::getExampleItems).orElse(Collections.emptyList()); @SuppressWarnings("unchecked") Map<ItemStack, ItemStack> smeltingList = FurnaceRecipes.smelting().getSmeltingList(); inputs.stream().map(ItemConverter.instance()::toNative).forEach(input -> smeltingList.remove(input)); }
Example #19
Source File: MinecraftRecipeRegistry.java From NOVA-Core with GNU Lesser General Public License v3.0 | 5 votes |
private void onNOVASmeltingAdded(RecipeEvent.Add<SmeltingRecipe> evt) { SmeltingRecipe recipe = evt.recipe; Collection<Item> inputs = recipe.getInput().map(ItemIngredient::getExampleItems).orElse(Collections.emptyList()); final Optional<ItemStack> output = recipe.getExampleOutput().map(ItemConverter.instance()::toNative); if (!output.isPresent()) return; inputs.stream().map(ItemConverter.instance()::toNative).forEach(input -> FurnaceRecipes.instance().addSmeltingRecipe(input, output.get(), 0)); }
Example #20
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals("smelting") && getClass() == FurnaceRecipeHandler.class) {//don't want subclasses getting a hold of this Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.instance().getSmeltingList(); for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); } else super.loadCraftingRecipes(outputId, results); }
Example #21
Source File: FurnaceRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public void loadCraftingRecipes(ItemStack result) { Map<ItemStack, ItemStack> recipes = (Map<ItemStack, ItemStack>) FurnaceRecipes.instance().getSmeltingList(); for (Entry<ItemStack, ItemStack> recipe : recipes.entrySet()) if (NEIServerUtils.areStacksSameType(recipe.getValue(), result)) arecipes.add(new SmeltingPair(recipe.getKey(), recipe.getValue())); }
Example #22
Source File: TileEntityEtherealMacerator.java From Electro-Magic-Tools with GNU General Public License v3.0 | 5 votes |
private boolean canSmelt() { if (this.slots[0] == null) { return false; } else { ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]); if (itemstack == null) return false; if (this.slots[2] == null) return true; if (!this.slots[2].isItemEqual(itemstack)) return false; int result = slots[2].stackSize + (itemstack.stackSize * 2); return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); } }
Example #23
Source File: SlotItemHandlerFurnaceOutput.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override protected void onCrafting(ItemStack stack) { stack.onCrafting(this.player.getEntityWorld(), this.player, this.amountCrafted); if (this.player.getEntityWorld().isRemote == false) { int i = this.amountCrafted; float f = FurnaceRecipes.instance().getSmeltingExperience(stack); if (f == 0.0F) { i = 0; } else if (f < 1.0F) { int j = MathHelper.floor((float)i * f); if (j < MathHelper.ceil((float)i * f) && Math.random() < (double)((float)i * f - (float)j)) { ++j; } i = j; } while (i > 0) { int k = EntityXPOrb.getXPSplit(i); i -= k; this.player.getEntityWorld().spawnEntity(new EntityXPOrb(this.player.getEntityWorld(), this.player.posX, this.player.posY + 0.5D, this.player.posZ + 0.5D, k)); } } this.amountCrafted = 0; net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(player, stack); }
Example #24
Source File: TileEntityCreationStation.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { if (stack.isEmpty()) { return false; } if (slot == 0 || slot == 3) { return FurnaceRecipes.instance().getSmeltingResult(stack).isEmpty() == false; } return (slot == 1 || slot == 4) && TileEntityEnderFurnace.isItemFuel(stack); }
Example #25
Source File: TileEntityEtherealMacerator.java From Electro-Magic-Tools with GNU General Public License v3.0 | 5 votes |
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { if (slot != 0) return false; if (FurnaceRecipes.smelting().getSmeltingResult(stack) != null) return true; return false; }
Example #26
Source File: TileEntityEnderFurnace.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean isItemValidForSlot(int slot, ItemStack stack) { if (stack.isEmpty()) { return false; } if (slot == SLOT_INPUT) { return FurnaceRecipes.instance().getSmeltingResult(stack).isEmpty() == false; } return slot == SLOT_FUEL && isItemFuel(stack); }
Example #27
Source File: GTHelperStack.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
/** removing smelting recipes code by Muramasa **/ public static void removeSmelting(ItemStack resultStack) { ItemStack recipeResult; Map<ItemStack, ItemStack> recipes = FurnaceRecipes.instance().getSmeltingList(); Iterator<ItemStack> iterator = recipes.keySet().iterator(); while (iterator.hasNext()) { ItemStack tmpRecipe = iterator.next(); recipeResult = recipes.get(tmpRecipe); if (ItemStack.areItemStacksEqual(resultStack, recipeResult)) { iterator.remove(); } } }
Example #28
Source File: TileEntityTFOven.java From TofuCraftReload with MIT License | 5 votes |
@Override public void done() { //Output outputs in the cached recipe, and do everything needed. ItemStack itemstack = this.inventory.get(0); ItemStack itemstack1 = FurnaceRecipes.instance().getSmeltingResult(itemstack); ItemStack itemstack2 = this.inventory.get(1); if (itemstack2.isEmpty()) { this.inventory.set(1, itemstack1.copy()); } else if (itemstack2.getItem() == itemstack1.getItem()) { itemstack2.grow(itemstack1.getCount()); } itemstack.shrink(1); }
Example #29
Source File: RecipeBuilder.java From EmergingTechnology with MIT License | 5 votes |
public static ItemStack getCookerOutputForItemStack(ItemStack itemStack) { ItemStack resultStack = FurnaceRecipes.instance().getSmeltingResult(itemStack); if (resultStack == null) { return null; } if (resultStack.getItem() instanceof ItemFood) { return resultStack; } return null; }
Example #30
Source File: CookerRecipes.java From EmergingTechnology with MIT License | 5 votes |
private static void registerCookerRecipes(List<ItemStack> inputs) { for (ItemStack input : inputs) { ItemStack output = FurnaceRecipes.instance().getSmeltingResult(input); SimpleRecipe recipe = new SimpleRecipe(output, input); add(recipe); } }