当前位置: 首页>>代码示例>>Java>>正文


Java FurnaceRecipes类代码示例

本文整理汇总了Java中net.minecraft.item.crafting.FurnaceRecipes的典型用法代码示例。如果您正苦于以下问题:Java FurnaceRecipes类的具体用法?Java FurnaceRecipes怎么用?Java FurnaceRecipes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FurnaceRecipes类属于net.minecraft.item.crafting包,在下文中一共展示了FurnaceRecipes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerRecipes

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
@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);
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:24,代码来源:ThermionicsWorld.java

示例2: tryCookSlot

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:SemiBlockHeatFrame.java

示例3: performWork

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
@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;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:17,代码来源:ResourcefulFurnaceTile.java

示例4: isItemValid

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
@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;
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:22,代码来源:SlotPanInput.java

示例5: isItemValid

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
@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;
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:25,代码来源:SlotSmelterInput.java

示例6: onUpdate

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
@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());
			}
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:22,代码来源:RitualFlames.java

示例7: loadCraftingRecipes

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
@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));
			}
		}

	}
}
 
开发者ID:CraftedMods,项目名称:nei-lotr,代码行数:18,代码来源:HobbitOvenHandler.java

示例8: attemptSmelting

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
/** 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;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:33,代码来源:CraftingHelper.java

示例9: isPartOfRecipe

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
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;
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:MachineManager.java

示例10: canSmelt

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:28,代码来源:TileEntityIronFurnace.java

示例11: apply

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
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;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:Smelt.java

示例12: canSmelt

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
/**
 * 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()));
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:TileEntityFurnace.java

示例13: smeltItem

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:29,代码来源:TileEntityFurnace.java

示例14: apply

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
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;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:Smelt.java

示例15: canSmelt

import net.minecraft.item.crafting.FurnaceRecipes; //导入依赖的package包/类
/**
 * 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.
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:TileEntityFurnace.java


注:本文中的net.minecraft.item.crafting.FurnaceRecipes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。