Java 类net.minecraft.item.crafting.FurnaceRecipes 实例源码

项目:ThermionicsWorld    文件:ThermionicsWorld.java   
@SubscribeEvent
public void registerRecipes(RegistryEvent.Register<IRecipe> evt) {  
    IForgeRegistry<IRecipe> r = evt.getRegistry();

    for(EnumEdibleMeat meat : EnumEdibleMeat.values()) {
        ItemStack uncraftedRaw = meat.getRawItem().copy(); uncraftedRaw.setCount(9);
        ItemStack uncraftedCooked = meat.getCookedItem().copy(); uncraftedCooked.setCount(9);
        addMeatCompressionRecipe(r, meat, false, meat.getRawItem().copy());
        addMeatCompressionRecipe(r, meat, true,  meat.getCookedItem().copy());
        addMeatUncraftingRecipe(r, meat, false, uncraftedRaw);
        addMeatUncraftingRecipe(r, meat, true, uncraftedCooked);

        FurnaceRecipes.instance().addSmeltingRecipe(
                TWItems.meat(meat, false),
                TWItems.meat(meat, true),
                0.0f);
    }

    for(BlockGemrock block : TWBlocks.GROUP_GEMROCK) addBrickRecipes(r, block);

    //Norfairite can be dyed. This is surprisingly hard to get right.
    addDyeRecipes(r, TWBlocks.NORFAIRITE_CLEAR);
}
项目:pnc-repressurized    文件:SemiBlockHeatFrame.java   
private boolean tryCookSlot(IItemHandler handler, int slot) {
    ItemStack stack = handler.getStackInSlot(slot);
    if (!stack.isEmpty()) {
        ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
        if (!result.isEmpty()) {
            ItemStack remainder = IOHelper.insert(getTileEntity(), result, true);
            if (remainder.isEmpty()) {
                IOHelper.insert(getTileEntity(), result, false);
                handler.extractItem(slot, 1, false);
                lastValidSlot = slot;
                return true;
            }
        }
    }
    return false;
}
项目:Industrial-Foregoing    文件:ResourcefulFurnaceTile.java   
@Override
protected float performWork() {
    if (WorkUtils.isDisabled(this.getBlockType())) return 0;

    boolean operation = false;
    for (int i = 0; i < input.getSlots(); ++i) {
        if (input.getStackInSlot(i).isEmpty()) continue;
        if (output.getStackInSlot(i).isEmpty() || (FurnaceRecipes.instance().getSmeltingResult(input.getStackInSlot(i)).isItemEqual(output.getStackInSlot(i)) && output.getStackInSlot(i).getCount() < output.getStackInSlot(i).getMaxStackSize())) {
            output.insertItem(i, FurnaceRecipes.instance().getSmeltingResult(input.getStackInSlot(i)).copy(), false);
            input.getStackInSlot(i).shrink(1);
            tank.fill(new FluidStack(FluidsRegistry.ESSENCE, (int) (FurnaceRecipes.instance().getSmeltingExperience(output.getStackInSlot(i)) * BlockRegistry.resourcefulFurnaceBlock.getExperienceMultiplier())), true);
            operation = true;
        }
    }
    return operation ? 1 : 0;
}
项目:ExSartagine    文件:SlotPanInput.java   
@Override
public boolean isItemValid(ItemStack stack) {
    if(!stack.isEmpty())
    {
        boolean flag = false;
        int[] ids = OreDictionary.getOreIDs(stack);
        for(int id: ids)
            if(OreDictionary.getOreName(id).contains("food")){
                flag = true;
                break;
            }
        if(stack.getItem() instanceof ItemFood || flag)
        {
            if(!FurnaceRecipes.instance().getSmeltingResult(stack).isEmpty())
            {
                return true;
            }
        }
    }
    return false;
}
项目:ExSartagine    文件:SlotSmelterInput.java   
@Override
public boolean isItemValid(ItemStack stack) {
    if(!stack.isEmpty())
    {
        if(stack.getItem() instanceof ItemBlock)
        {
            for(ItemStack ore : ores)
                if(OreDictionary.itemMatches(ore, stack, false))
                {
                    return true;
                }
        }

        else
        {
            ItemStack result = FurnaceRecipes.instance().getSmeltingResult(getStack());
            if (result.getItem().equals(Items.field_191525_da))
            {
                return true;
            }
        }
    }
    return false;
}
项目:Bewitchment    文件:RitualFlames.java   
@Override
public void onUpdate(EntityPlayer player, IRitualHandler tile, World world, BlockPos pos, NBTTagCompound data, int ticks) {
    if (ticks % 40 == 0) {
        List<EntityItem> smeltables = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos).grow(3), ie -> !FurnaceRecipes.instance().getSmeltingResult(ie.getItem()).isEmpty());
        smeltables.parallelStream().filter(ei -> !ei.getItem().getItem().hasContainerItem(ei.getItem())).findAny().ifPresent(e -> smeltAndSpawn(e));
        if (rng.nextDouble() < 0.1) {
            if (world.getGameRules().getBoolean("doFireTick")) {
                int x = Math.round(pos.getX()) - 5 + rng.nextInt(12);
                int y = Math.round(pos.getY()) - 5 + rng.nextInt(12);
                int z = Math.round(pos.getZ()) - 5 + rng.nextInt(12);
                if (y < 1)
                    y = 1;
                if (y > world.getActualHeight())
                    y = world.getActualHeight() - 2;
                BlockPos posn = new BlockPos(x, y, z);
                if (canBurn(world, posn))
                    world.setBlockState(posn, Blocks.FIRE.getDefaultState());
            }
        }
    }
}
项目:nei-lotr    文件:HobbitOvenHandler.java   
@Override
public void loadCraftingRecipes(ItemStack result) {
    result.stackSize = 1;
    if (dummy.isCookResultAcceptable(result)) {
        Map map = FurnaceRecipes.smelting().getSmeltingList();
        Iterator it = map.keySet().iterator();

        while (it.hasNext()) {
            ItemStack itemStack = (ItemStack) it.next();
            if (NEIClientUtils.areStacksSameTypeCrafting(FurnaceRecipes.smelting().getSmeltingResult(itemStack),
                    result)) {
                arecipes.add(new CachedOvenRecipe(itemStack, result));
            }
        }

    }
}
项目:Proyecto-DASI    文件:CraftingHelper.java   
/** Attempt to smelt the given item.<br>
 * This returns instantly, callously disregarding such frivolous niceties as cooking times or the presence of a furnace.<br>
 * It will, however, consume fuel from the player's inventory.
 * @param player
 * @param input the raw ingredients we want to cook.
 * @return true if cooking was successful.
 */
public static boolean attemptSmelting(EntityPlayerMP player, ItemStack input)
{
    if (player == null || input == null)
        return false;
    List<ItemStack> ingredients = new ArrayList<ItemStack>();
    ingredients.add(input);
    ItemStack isOutput = (ItemStack)FurnaceRecipes.instance().getSmeltingList().get(input);
    if (isOutput == null)
        return false;
    int cookingTime = 200;  // Seems to be hard-coded in TileEntityFurnace.
    if (playerHasIngredients(player, ingredients) && totalBurnTimeInInventory(player) >= cookingTime)
    {
        removeIngredientsFromPlayer(player, ingredients);
        burnInventory(player, cookingTime, input);

        ItemStack resultForInventory = isOutput.copy();
        ItemStack resultForReward = isOutput.copy();
        player.inventory.addItemStackToInventory(resultForInventory);
        RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward);
        MinecraftForge.EVENT_BUS.post(event);

        return true;
    }
    return false;
}
项目:Proyecto-DASI    文件:CraftingHelper.java   
/** Attempt to smelt the given item.<br>
 * This returns instantly, callously disregarding such frivolous niceties as cooking times or the presence of a furnace.<br>
 * It will, however, consume fuel from the player's inventory.
 * @param player
 * @param input the raw ingredients we want to cook.
 * @return true if cooking was successful.
 */
public static boolean attemptSmelting(EntityPlayerMP player, ItemStack input)
{
    if (player == null || input == null)
        return false;
    List<ItemStack> ingredients = new ArrayList<ItemStack>();
    ingredients.add(input);
    ItemStack isOutput = (ItemStack)FurnaceRecipes.instance().getSmeltingList().get(input);
    if (isOutput == null)
        return false;
    int cookingTime = 200;  // Seems to be hard-coded in TileEntityFurnace.
    if (playerHasIngredients(player, ingredients) && totalBurnTimeInInventory(player) >= cookingTime)
    {
        removeIngredientsFromPlayer(player, ingredients);
        burnInventory(player, cookingTime, input);

        ItemStack resultForInventory = isOutput.copy();
        ItemStack resultForReward = isOutput.copy();
        player.inventory.addItemStackToInventory(resultForInventory);
        RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward);
        MinecraftForge.EVENT_BUS.post(event);

        return true;
    }
    return false;
}
项目:customstuff4    文件:MachineManager.java   
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;
}
项目:morefurnaces    文件:TileEntityIronFurnace.java   
/**
 * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc.
 */
private boolean canSmelt(int id)
{
    int inputIndex = type.getFirstInputSlot(id);
    int outputIndex = type.getFirstOutputSlot(id);

    ItemStack input = itemHandler.getStackInSlot(inputIndex);
    ItemStack output = itemHandler.getStackInSlot(outputIndex);

    if (input.isEmpty())
    {
        return false;
    } else
    {
        ItemStack res = FurnaceRecipes.instance().getSmeltingResult(input);
        if (res.isEmpty())
            return false;
        if (output.isEmpty())
            return true;
        if (!output.isItemEqual(res))
            return false;
        int result = output.getCount() + res.getCount();
        return result <= itemHandler.getSlotLimit(outputIndex) && result <= res.getMaxStackSize();
    }
}
项目:Backmemed    文件:Smelt.java   
public ItemStack apply(ItemStack stack, Random rand, LootContext context)
{
    ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(stack);

    if (itemstack.func_190926_b())
    {
        LOGGER.warn("Couldn\'t smelt {} because there is no smelting recipe", new Object[] {stack});
        return stack;
    }
    else
    {
        ItemStack itemstack1 = itemstack.copy();
        itemstack1.func_190920_e(stack.func_190916_E());
        return itemstack1;
    }
}
项目:Backmemed    文件:TileEntityFurnace.java   
/**
 * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc.
 */
private boolean canSmelt()
{
    if (((ItemStack)this.furnaceItemStacks.get(0)).func_190926_b())
    {
        return false;
    }
    else
    {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult((ItemStack)this.furnaceItemStacks.get(0));

        if (itemstack.func_190926_b())
        {
            return false;
        }
        else
        {
            ItemStack itemstack1 = (ItemStack)this.furnaceItemStacks.get(2);
            return itemstack1.func_190926_b() ? true : (!itemstack1.isItemEqual(itemstack) ? false : (itemstack1.func_190916_E() < this.getInventoryStackLimit() && itemstack1.func_190916_E() < itemstack1.getMaxStackSize() ? true : itemstack1.func_190916_E() < itemstack.getMaxStackSize()));
        }
    }
}
项目:Backmemed    文件:TileEntityFurnace.java   
/**
 * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack
 */
public void smeltItem()
{
    if (this.canSmelt())
    {
        ItemStack itemstack = (ItemStack)this.furnaceItemStacks.get(0);
        ItemStack itemstack1 = FurnaceRecipes.instance().getSmeltingResult(itemstack);
        ItemStack itemstack2 = (ItemStack)this.furnaceItemStacks.get(2);

        if (itemstack2.func_190926_b())
        {
            this.furnaceItemStacks.set(2, itemstack1.copy());
        }
        else if (itemstack2.getItem() == itemstack1.getItem())
        {
            itemstack2.func_190917_f(1);
        }

        if (itemstack.getItem() == Item.getItemFromBlock(Blocks.SPONGE) && itemstack.getMetadata() == 1 && !((ItemStack)this.furnaceItemStacks.get(1)).func_190926_b() && ((ItemStack)this.furnaceItemStacks.get(1)).getItem() == Items.BUCKET)
        {
            this.furnaceItemStacks.set(1, new ItemStack(Items.WATER_BUCKET));
        }

        itemstack.func_190918_g(1);
    }
}
项目:CustomWorldGen    文件:Smelt.java   
public ItemStack apply(ItemStack stack, Random rand, LootContext context)
{
    ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(stack);

    if (itemstack == null)
    {
        LOGGER.warn("Couldn\'t smelt {} because there is no smelting recipe", new Object[] {stack});
        return stack;
    }
    else
    {
        ItemStack itemstack1 = itemstack.copy();
        itemstack1.stackSize = stack.stackSize;
        return itemstack1;
    }
}
项目:CustomWorldGen    文件:TileEntityFurnace.java   
/**
 * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc.
 */
private boolean canSmelt()
{
    if (this.furnaceItemStacks[0] == null)
    {
        return false;
    }
    else
    {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]);
        if (itemstack == null) return false;
        if (this.furnaceItemStacks[2] == null) return true;
        if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false;
        int result = furnaceItemStacks[2].stackSize + itemstack.stackSize;
        return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly.
    }
}
项目:ModularMachinery    文件:AdapterMinecraftFurnace.java   
@Nonnull
@Override
public Collection<MachineRecipe> createRecipesFor(ResourceLocation owningMachineName) {
    Map<ItemStack, ItemStack> inputOutputMap = FurnaceRecipes.instance().getSmeltingList();
    List<MachineRecipe> smeltingRecipes = new ArrayList<>(inputOutputMap.size());
    int incId = 0;
    for (Map.Entry<ItemStack, ItemStack> smelting : inputOutputMap.entrySet()) {
        MachineRecipe recipe = createRecipeShell(
                new ResourceLocation("minecraft", "smelting_recipe_" + incId),
                owningMachineName,
                120, 0);
        recipe.addRequirement(new ComponentRequirement.RequirementItem(MachineComponent.IOType.INPUT,
                ItemUtils.copyStackWithSize(smelting.getKey(), smelting.getKey().getCount())));
        recipe.addRequirement(new ComponentRequirement.RequirementItem(MachineComponent.IOType.OUTPUT,
                ItemUtils.copyStackWithSize(smelting.getValue(), smelting.getValue().getCount())));
        recipe.addRequirement(new ComponentRequirement.RequirementEnergy(MachineComponent.IOType.INPUT,
                20));
        smeltingRecipes.add(recipe);
        incId++;
    }
    return smeltingRecipes;
}
项目:LittleThings-old    文件:TileEntityMetalFurnace.java   
public void smeltItem()
{
    if (this.canSmelt()) {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]);

        if (this.furnaceItemStacks[2] == null) {
            this.furnaceItemStacks[2] = itemstack.copy();
        } else if (this.furnaceItemStacks[2].getItem() == itemstack.getItem()) {
            this.furnaceItemStacks[2].stackSize += itemstack.stackSize; // Forge BugFix: Results may have multiple items
        }

        if (this.furnaceItemStacks[0].getItem() == Item.getItemFromBlock(Blocks.sponge) && this.furnaceItemStacks[0].getMetadata() == 1 && this.furnaceItemStacks[1] != null && this.furnaceItemStacks[1].getItem() == Items.bucket) {
            this.furnaceItemStacks[1] = new ItemStack(Items.water_bucket);
        }

        --this.furnaceItemStacks[0].stackSize;

        if (this.furnaceItemStacks[0].stackSize <= 0) {
            this.furnaceItemStacks[0] = null;
        }
    }
}
项目:4Space-5    文件:TileEntityElectricFurnace.java   
/**
 * @return Is this machine able to process its specific task?
 */
public boolean canProcess()
{
    if (this.containingItems[1] == null || FurnaceRecipes.smelting().getSmeltingResult(this.containingItems[1]) == null)
    {
        return false;
    }

    if (this.containingItems[2] != null)
    {
        if (!this.containingItems[2].isItemEqual(FurnaceRecipes.smelting().getSmeltingResult(this.containingItems[1])))
        {
            return false;
        }

        if (this.containingItems[2].stackSize + 1 > 64)
        {
            return false;
        }
    }

    return true;
}
项目:CrystalMod    文件:CrystalFurnaceManager.java   
public static BasicMachineRecipe getRecipe(ItemStack input){
    if (ItemStackTools.isNullStack(input)) {
        return null;
    }
    for(ItemStack stack : recipeMap.keySet()){
        if(ItemUtil.stackMatchUseOre(input, stack)){
            return recipeMap.get(stack);
        }
    }
    if(ItemStackTools.isValid(FurnaceRecipes.instance().getSmeltingResult(input))){
        ItemStack output = FurnaceRecipes.instance().getSmeltingResult(input).copy();
        int i = 1600;
        if ((output.getItem() instanceof ItemFood)) {
            i /= 2;
        }
        if ((input.getItem() instanceof ItemFood)) {
            i /= 2;
        }
        if ((ItemUtil.isDust(output)) && (ItemUtil.isIngot(output))) {
            i = 1000;
        }
        return new BasicMachineRecipe(input, output, i);
    }
    return null;
}
项目:InspiringWorld    文件:TileEntityInspiringFurnace.java   
@Override
public void update() {
    if (!this.worldObj.isRemote) {
        if (this.energyContained > 0) {
            this.energyContained -= 1;
            this.progress = Math.min(this.progress + 0.005f, 1);
            if (this.progress >= 1) {
                ItemStack inputStack = this.inputStack.extractItem(0, 1, true);
                if (inputStack != null) {
                    ItemStack outputStack = FurnaceRecipes.instance().getSmeltingResult(inputStack);
                    if (this.outputStack.insertItem(0, outputStack, true) == null) {
                        inputStack = this.inputStack.extractItem(0, 1, false);
                        outputStack = FurnaceRecipes.instance().getSmeltingResult(inputStack);
                        this.outputStack.insertItem(0, outputStack, false);
                        this.progress = 0;
                    }
                }
            }
        } else {
            this.progress = Math.max(0, this.progress - 0.025f);
        }
    }
}
项目:malmo    文件:CraftingHelper.java   
/** Attempt to smelt the given item.<br>
 * This returns instantly, callously disregarding such frivolous niceties as cooking times or the presence of a furnace.<br>
 * It will, however, consume fuel from the player's inventory.
 * @param player
 * @param input the raw ingredients we want to cook.
 * @return true if cooking was successful.
 */
public static boolean attemptSmelting(EntityPlayerMP player, ItemStack input)
{
    if (player == null || input == null)
        return false;
    List<ItemStack> ingredients = new ArrayList<ItemStack>();
    ingredients.add(input);
    ItemStack isOutput = (ItemStack)FurnaceRecipes.instance().getSmeltingList().get(input);
    if (isOutput == null)
        return false;
    int cookingTime = 200;  // Seems to be hard-coded in TileEntityFurnace.
    if (playerHasIngredients(player, ingredients) && totalBurnTimeInInventory(player) >= cookingTime)
    {
        removeIngredientsFromPlayer(player, ingredients);
        burnInventory(player, cookingTime, input);

        ItemStack resultForInventory = isOutput.copy();
        ItemStack resultForReward = isOutput.copy();
        player.inventory.addItemStackToInventory(resultForInventory);
        RewardForCollectingItemImplementation.GainItemEvent event = new RewardForCollectingItemImplementation.GainItemEvent(resultForReward);
        MinecraftForge.EVENT_BUS.post(event);

        return true;
    }
    return false;
}
项目:ExNihiloAdscensio    文件:OreRegistry.java   
public static void doRecipes() {
    for (ItemOre ore : itemOreRegistry) {
        if (Config.shouldOreDictOreChunks)
            OreDictionary.registerOre("ore"+StringUtils.capitalize(ore.getOre().getName()), new ItemStack(ore, 1, 1));
        if (Config.shouldOreDictOreDusts)
            OreDictionary.registerOre("dust"+StringUtils.capitalize(ore.getOre().getName()), new ItemStack(ore, 1, 2));
        GameRegistry.addRecipe(new ItemStack(ore, 1, 1),
                new Object[] { "xx", "xx", 'x', new ItemStack(ore, 1, 0) });

        ItemStack smeltingResult;

        if (ore.isRegisterIngot()) {
            smeltingResult = new ItemStack(ore, 1, 3);
            OreDictionary.registerOre("ingot" + StringUtils.capitalize(ore.getOre().getName()), smeltingResult);
            if (ore.getOre().getName().contains("aluminium"))
                OreDictionary.registerOre("ingotAluminum", smeltingResult);
        } else {
            smeltingResult = ore.getOre().getResult().getItemStack();
        }

        FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ore, 1, 1), smeltingResult, 0.7f);
        FurnaceRecipes.instance().addSmeltingRecipe(new ItemStack(ore, 1, 2), smeltingResult, 0.7f);
    }
}
项目:CraftingHarmonics    文件:AddFurnaceOperation.java   
@Override
public void apply() {
    LogHelper.info("Adding furnace recipe for " + output.toString());
    float curXp = FurnaceRecipes.instance().getSmeltingExperience(output.getItemStack());
    setXp = curXp == 0.0F;
    if(curXp != 0.0F && curXp != experience) {
        LogHelper.warn(output.toString()
                + " is already registered as a furnace output. Due to how Minecraft handles smelting XP, this will"
                + " always give you '" + curXp + "' XP per item instead of the '" + experience + "' you set.");
    }

    // Only add in an experience entry if it'll matter:
    if(setXp) {
        FurnaceRecipes.instance().addSmeltingRecipe(inputStack, outputStack, experience);
    } else {
        FurnaceRecipes.instance().getSmeltingList().put(inputStack, outputStack);
    }
}
项目:LightningCraft    文件:TileEntityLightningFurnace.java   
/** Can the item be smelted? */
private boolean canSmelt() {

    // quick exit
    if(!this.hasLPCell() || !this.canDrawCellPower(1)) return false;

    if (this.stacks[0] == null) {
        return false;
    } else {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.stacks[0]);
        if (itemstack == null) return false;
        if (this.stacks[1] == null) return true;
        if (!this.stacks[1].isItemEqual(itemstack)) return false;
        int result = stacks[1].stackSize + itemstack.stackSize;
        return result <= getInventoryStackLimit() && result <= this.stacks[1].getMaxStackSize();
    }
}
项目:LightningCraft    文件:TileEntityLightningFurnace.java   
/** Smelt the item */
private void smeltItem() {
    if (this.canSmelt()) {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.stacks[0]);

        if (this.stacks[1] == null) {
            this.stacks[1] = itemstack.copy();
        } else if (this.stacks[1].getItem() == itemstack.getItem()) {
            this.stacks[1].stackSize += itemstack.stackSize;
        }

        --this.stacks[0].stackSize;

        if(this.stacks[0].stackSize <= 0){
            this.stacks[0] = null;
        }
    }
}
项目:TombCraft    文件:TileEntityRelicLab.java   
public void smeltItem()
{
    if(this.canSmelt())
    {
        ItemStack itemStack = FurnaceRecipes.instance().getSmeltingResult(this.slots[0]);

        if(this.slots[2] == null)
        {
            this.slots[2] = itemStack.copy();
        }
        else if(this.slots[2].isItemEqual(itemStack))
        {
            this.slots[2].stackSize += itemStack.stackSize;
        }

        this.slots[0].stackSize--;

        if(this.slots[0].stackSize <= 0)
        {
            this.slots[0] = null;
        }
    }
}
项目:Minecraft-Modding-Tutorials    文件:TileEntityCopperFurnace.java   
/**
 * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc.
 */
private boolean canSmelt()
{
    if (this.furnaceItemStacks[0] == null)
    {
        return false;
    }
    else
    {
        ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(this.furnaceItemStacks[0]);
        if (itemstack == null) return false;
        if (this.furnaceItemStacks[2] == null) return true;
        if (!this.furnaceItemStacks[2].isItemEqual(itemstack)) return false;
        int result = furnaceItemStacks[2].stackSize + itemstack.stackSize;
        return result <= getInventoryStackLimit() && result <= this.furnaceItemStacks[2].getMaxStackSize(); //Forge BugFix: Make it respect stack sizes properly.
    }
}
项目:Nuclear-Foundation    文件:EventHandler.java   
@SubscribeEvent
public void onDrop(HarvestDropsEvent event){
    if(Config.IsToolsEnabled&&!event.getWorld().isRemote&&event.getHarvester()!=null&&isBlazonium(event.getHarvester())){
        for(int i=0;i<event.getDrops().size();i++){
            if(event.getDrops().get(i)!=null){
                if(FurnaceRecipes.instance().getSmeltingResult(event.getDrops().get(i))!=null){
                    event.getDrops().set(i, FurnaceRecipes.instance().getSmeltingResult(event.getDrops().get(i)).copy());
                }
            }
        }
    }
    if(Config.IsToolsEnabled&&!event.getWorld().isRemote&&event.getHarvester()!=null&&isEmerald(event.getHarvester())){
        if(event.isSilkTouching()==false&&event.getFortuneLevel()<=Config.MaxGreed){
            List<ItemStack> list=event.getDrops();
            list.clear();
            List<ItemStack> newlist=event.getState().getBlock().getDrops(event.getWorld(), event.getPos(), event.getState(), event.getFortuneLevel()+1);
            for(int i=0;i<newlist.size();i++){
                list.add(newlist.get(i).copy());
            }
        }
    }
}
项目:PowerLines    文件:FurnaceRecipesHandler.java   
public static void registerRecipes()
{
    FurnaceRecipes.smelting().func_151393_a(
            Blocks.iron_block,
            new ItemStack(PowerLinesMod.items.craftingAlpha, 1, ItemCraftingAlpha.IRON_BASE_PLATE_DAMAGE),
            0
    );

    FurnaceRecipes.smelting().func_151394_a(
            new ItemStack(PowerLinesMod.items.craftingAlpha, 1, ItemCraftingAlpha.UNFIRED_CERAMIC_DISK_DAMAGE),
            new ItemStack(PowerLinesMod.items.craftingAlpha, 1, ItemCraftingAlpha.CERAMIC_DISK_DAMAGE),
            0
    );

    FurnaceRecipes.smelting().func_151394_a(
            new ItemStack(Blocks.light_weighted_pressure_plate),
            new ItemStack(PowerLinesMod.items.craftingAlpha, 1, ItemCraftingAlpha.SMALL_IRON_BASE_PLATE_DAMAGE),
            0
    );
}
项目:AetherCraft2    文件:FurnaceHandler.java   
@Override
public List<RecipeLink> getRecipes() {
    List<RecipeLink> a = new ArrayList<RecipeLink>();

    for (Object obj : FurnaceRecipes.smelting().getSmeltingList().entrySet()) {
        Map.Entry<ItemStack, ItemStack> entry = ((Map.Entry)obj);

        RecipeLink link = new RecipeLink();
        link.inputs.add(new ItemDataStack(entry.getKey()));
        link.outputs.add(new ItemDataStack(entry.getValue()));

        a.add(link);
    }

    return a;
}
项目:SteamAdvantage    文件:BlastFurnaceTileEntity.java   
@Override
public boolean isItemValidForSlot(final int slot, final ItemStack item) {
    switch(slot){
    case 0:
        return this.getFuelBurnTime(item) > 0;
    case 1:
    case 2:
    case 3:
        return FurnaceRecipes.instance().getSmeltingResult(item) != null;
    case 4:
    case 5:
    case 6:
        return true;
    default:
        return false;
    }
}
项目:vsminecraft    文件:EntityFlame.java   
private boolean smeltItem(EntityItem item)
{
    ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(item.getEntityItem());

    if(result != null)
    {
        item.setEntityItemStack(StackUtils.size(result, item.getEntityItem().stackSize));
        item.ticksExisted = 0;

        spawnParticlesAt(new Pos3D(item));
        worldObj.playSoundAtEntity(item, "random.fizz", 1.0F, 1.0F);

        return true;
    }

    return false;
}
项目:vsminecraft    文件:EntityRobit.java   
public void smeltItem()
{
    if(canSmelt())
    {
        ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(inventory[28]);

        if(inventory[30] == null)
        {
            inventory[30] = itemstack.copy();
        }
        else if(inventory[30].isItemEqual(itemstack))
        {
            inventory[30].stackSize += itemstack.stackSize;
        }

        inventory[28].stackSize--;

        if(inventory[28].stackSize <= 0)
        {
            inventory[28] = null;
        }
    }
}
项目:vsminecraft    文件:Mekanism.java   
@EventHandler
public void serverStarting(FMLServerStartingEvent event)
{
    if(general.voiceServerEnabled)
    {
        voiceManager.start();
    }

    //Load cached furnace recipes
    Recipe.ENERGIZED_SMELTER.get().clear();

    for(Object obj : FurnaceRecipes.smelting().getSmeltingList().entrySet())
    {
        Map.Entry<ItemStack, ItemStack> entry = (Map.Entry<ItemStack, ItemStack>)obj;
        SmeltingRecipe recipe = new SmeltingRecipe(new ItemStackInput(entry.getKey()), new ItemStackOutput(entry.getValue()));
        Recipe.ENERGIZED_SMELTER.put(recipe);
    }

    event.registerServerCommand(new CommandMekanism());
}
项目:SmeltyCraft    文件:TileEntitySmeltingFurnace.java   
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 = this.slots[2].stackSize + itemStack.stackSize;

        return (result <= getInventoryStackLimit() && result <= itemStack.getMaxStackSize());
    }
}
项目:SmeltyCraft    文件:TileEntitySmeltingFurnace.java   
public void smeltItem(){
    if(this.canSmelt())
    {
        ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[0]);

        if(this.slots[2] == null)
        {
            this.slots[2] = itemStack.copy();
        }
        else  if(this.slots[2].isItemEqual(itemStack))
        {
            this.slots[2].stackSize += itemStack.stackSize;
        }

        this.slots[0].stackSize --;

        if(this.slots[0].stackSize <= 0)
        {
            this.slots[0] = null;
        }
    }
}
项目:UHC-Reloaded    文件:Misc.java   
/**
 * Remove certain vanilla recipe and smelting. Has been rewritten.
 *
 * @param item The item whose recipe you want to remove
 */
public static void removeRecipe(ItemStack item) {
    Iterator<IRecipe> recipeIterator = CraftingManager.getInstance().getRecipeList().iterator();
    while (recipeIterator.hasNext()) {
        IRecipe recipe = recipeIterator.next();
        if (recipe.getRecipeOutput().isItemEqual(item)) {
            recipeIterator.remove();
        }
    }

    Iterator<Map.Entry<ItemStack, ItemStack>> smeltingIterator = FurnaceRecipes.instance().getSmeltingList().entrySet().iterator();
    while (smeltingIterator.hasNext()) {
        Map.Entry<ItemStack, ItemStack> entry = smeltingIterator.next();
        if (entry.getKey().isItemEqual(item)) {
            smeltingIterator.remove();
        }
    }
}
项目:HarderStart    文件:FurnaceRecipeHandler.java   
/**
 * Iterates through furnace recipes removes those I don't want TODO use for
 * something worthwhile
 */
public static void recipeRemover()
{
    Map<Integer, ItemStack> recipes = FurnaceRecipes.smelting().getSmeltingList();

    Iterator current = recipes.entrySet().iterator();

    while (current.hasNext())
    {
        Map.Entry<Integer, ItemStack> entry = (Entry<Integer, ItemStack>) current.next();
        ItemStack stack = (ItemStack) entry.getValue();
        if (ItemFood.class.isAssignableFrom(stack.getItem().getClass()))
        {
            current.remove();
        }
        else if (stack.getItem() == Items.iron_ingot)
        {
            current.remove();
        }
    }

    return;
}
项目:Resilience-Client-Source    文件:TileEntityFurnace.java   
public void func_145949_j()
{
    if (this.func_145948_k())
    {
        ItemStack var1 = FurnaceRecipes.smelting().func_151395_a(this.field_145957_n[0]);

        if (this.field_145957_n[2] == null)
        {
            this.field_145957_n[2] = var1.copy();
        }
        else if (this.field_145957_n[2].getItem() == var1.getItem())
        {
            ++this.field_145957_n[2].stackSize;
        }

        --this.field_145957_n[0].stackSize;

        if (this.field_145957_n[0].stackSize <= 0)
        {
            this.field_145957_n[0] = null;
        }
    }
}