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


Java InventoryCrafting类代码示例

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


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

示例1: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
public ItemStack[] getRemainingItems(InventoryCrafting craftMatrix, World worldIn)
{
    for (IRecipe irecipe : this.recipes)
    {
        if (irecipe.matches(craftMatrix, worldIn))
        {
            return irecipe.getRemainingItems(craftMatrix);
        }
    }

    ItemStack[] aitemstack = new ItemStack[craftMatrix.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        aitemstack[i] = craftMatrix.getStackInSlot(i);
    }

    return aitemstack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:CraftingManager.java

示例2: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	ItemStack out = new ItemStack(ModItems.hoe);

	if (adornmentMat == null) {
		adornmentMat = ModMaterials.ADORNMENT_NULL;
	}

	if (headMat == null || haftMat == null || handleMat == null || adornmentMat == null) {
		return ItemStack.EMPTY;
	}

	NBTTagCompound tag = new NBTTagCompound();
	tag.setString(IHeadTool.HEAD_TAG, headMat.getName());
	tag.setString(IHaftTool.HAFT_TAG, haftMat.getName());
	tag.setString(IHandleTool.HANDLE_TAG, handleMat.getName());
	tag.setString(IAdornedTool.ADORNMENT_TAG, adornmentMat.getName());
	out.setTagCompound(tag);

	return out;
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:22,代码来源:HoeRecipe.java

示例3: test_useUpItem

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Test
public void test_useUpItem()
{
    DamageableShapelessOreRecipe recipe = new DamageableShapelessOreRecipe(new ResourceLocation("group"),
                                                                           new int[] {60}, new ItemStack(Blocks.DIRT), new ItemStack(Items.WOODEN_SWORD));
    InventoryCrafting inv = new InventoryCrafting(new Container()
    {
        @Override
        public boolean canInteractWith(EntityPlayer playerIn)
        {
            return false;
        }
    }, 3, 3);
    inv.setInventorySlotContents(3, new ItemStack(Items.WOODEN_SWORD));

    assertTrue(recipe.matches(inv, null));
    NonNullList<ItemStack> remaining = recipe.getRemainingItems(inv);
    assertTrue(remaining.get(3).isEmpty());
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:20,代码来源:DamageableShapelessOreRecipeTest.java

示例4: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	ItemStack out = new ItemStack(ModItems.shovel);

	if (adornmentMat == null) {
		adornmentMat = ModMaterials.ADORNMENT_NULL;
	}

	if (headMat == null || haftMat == null || handleMat == null || adornmentMat == null) {
		return ItemStack.EMPTY;
	}

	NBTTagCompound tag = new NBTTagCompound();
	tag.setString(IHeadTool.HEAD_TAG, headMat.getName());
	tag.setString(IHaftTool.HAFT_TAG, haftMat.getName());
	tag.setString(IHandleTool.HANDLE_TAG, handleMat.getName());
	tag.setString(IAdornedTool.ADORNMENT_TAG, adornmentMat.getName());
	out.setTagCompound(tag);

	return out;
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:22,代码来源:ShovelRecipe.java

示例5: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting invCrafting) {
    ItemStack potion = ItemStack.EMPTY;
    ItemStack ammo = ItemStack.EMPTY;
    for (int i = 0; i < invCrafting.getSizeInventory(); i++) {
        ItemStack stack = invCrafting.getStackInSlot(i);
        if (!stack.isEmpty()) {
            if (stack.getItem() == Items.POTIONITEM) {
                potion = stack;
            } else {
                ammo = stack;
            }
        }
    }
    ammo = ammo.copy();
    ItemGunAmmo.setPotion(ammo, potion);
    return ammo;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:19,代码来源:RecipeGunAmmo.java

示例6: getRemainingItems

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
public ItemStack[] getRemainingItems(InventoryCrafting inv)
{
    ItemStack[] aitemstack = new ItemStack[inv.getSizeInventory()];

    for (int i = 0; i < aitemstack.length; ++i)
    {
        ItemStack itemstack = inv.getStackInSlot(i);

        if (itemstack != null && itemstack.getItem().hasContainerItem())
        {
            aitemstack[i] = new ItemStack(itemstack.getItem().getContainerItem());
        }
    }

    return aitemstack;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:17,代码来源:RecipesArmorDyes.java

示例7: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	// TODO Auto-generated method stub
	ItemStack stack2 = ItemStack.EMPTY;

	for (int x = 0; x < inv.getSizeInventory(); x++) {
		ItemStack stack = inv.getStackInSlot(x);
		if (!stack.isEmpty())
			if (!(stack.getItem() == Items.FEATHER))
				stack2 = stack;
	}
	// System.out.println("OutPut: "+stack2);
	if (!stack2.isEmpty()) {
		if(ItemFromData.isSameType(stack2, nameBefore))
			stack2=ItemFromData.getNewStack(nameAfter);
	}
	return stack2;
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:JumperRecipe.java

示例8: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = null;

    for (int i = 0; i < inv.getSizeInventory() && itemstack == null; ++i)
    {
        ItemStack itemstack1 = inv.getStackInSlot(i);

        if (itemstack1 != null && itemstack1.getItem() == Items.filled_map)
        {
            itemstack = itemstack1;
        }
    }

    itemstack = itemstack.copy();
    itemstack.stackSize = 1;

    if (itemstack.getTagCompound() == null)
    {
        itemstack.setTagCompound(new NBTTagCompound());
    }

    itemstack.getTagCompound().setBoolean("map_is_scaling", true);
    return itemstack;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:RecipesMapExtending.java

示例9: matches

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
/**
 * Used to check if a recipe matches current crafting inventory
 */
public boolean matches(InventoryCrafting inv, World worldIn)
{
    for (int i = 0; i <= 3 - this.recipeWidth; ++i)
    {
        for (int j = 0; j <= 3 - this.recipeHeight; ++j)
        {
            if (this.checkMatch(inv, i, j, true))
            {
                return true;
            }

            if (this.checkMatch(inv, i, j, false))
            {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:ShapedRecipes.java

示例10: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
	ItemStack inputSlaw = inv.getStackInSlot(0);

	byte additions = 0;
	if (inputSlaw.hasTagCompound()) {
		additions = inputSlaw.getTagCompound().getByte("additions");
	}
	additions += 1;

	ItemStack outputStack = new ItemStack(ModItems.simic_slaw);
	outputStack.setTagCompound(new NBTTagCompound());
	outputStack.getTagCompound().setByte("additions", additions);

	return outputStack;
}
 
开发者ID:DarkMorford,项目名称:BetterThanWeagles,代码行数:17,代码来源:RecipeSimicSlaw.java

示例11: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inventoryCrafting) {
    ItemStack result = super.getCraftingResult(inventoryCrafting);
    if (!result.isEmpty()) {

        ItemStack portalGunItem = ItemStack.EMPTY;

        for (int i = 0; i < inventoryCrafting.getSizeInventory(); ++i) {
            ItemStack stack = inventoryCrafting.getStackInSlot(i);

            if (!stack.isEmpty()) {
                if (stack.getItem() instanceof PortalGunItem) {
                    portalGunItem = stack;
                }
            }
        }

        if (!portalGunItem.isEmpty()) {
            int charge = PortalGunItem.getCharge(portalGunItem);
            CartridgeItem.setCharge(result, charge);
        }
    }
    return result;
}
 
开发者ID:McJty,项目名称:MeeCreeps,代码行数:25,代码来源:RemoveCartridgeFactory.java

示例12: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    ItemStack itemstack = this.getRecipeOutput().copy();

    if (this.copyIngredientNBT)
    {
        for (int i = 0; i < inv.getSizeInventory(); ++i)
        {
            ItemStack itemstack1 = inv.getStackInSlot(i);

            if (itemstack1 != null && itemstack1.hasTagCompound())
            {
                itemstack.setTagCompound((NBTTagCompound)itemstack1.getTagCompound().copy());
            }
        }
    }

    return itemstack;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:ShapedRecipes.java

示例13: matches

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
public boolean matches(InventoryCrafting invCrafting, InventoryWorkbenchAdditionalMaterials materials,
                       World world)
{
	for (int i = 0; i <= 3 - recipeWidth; ++i)
	{
		for (int j = 0; j <= 3 - recipeHeight; ++j)
		{
			if (checkMatch(invCrafting, materials, i, j, false))
			{
				return true;
			}

			if (mirrored && checkMatch(invCrafting, materials, i, j, true))
			{
				return true;
			}
		}
	}

	return false;
}
 
开发者ID:einsteinsci,项目名称:BetterBeginningsReborn,代码行数:22,代码来源:AdvancedRecipe.java

示例14: matches

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public boolean matches(InventoryCrafting inv, World worldIn) {
    int count = 0;
    boolean forge = false;
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if(!stack.isEmpty()) {
            if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof CraftiniumForge) {
                if(forge && !this.combining) {
                    return false;
                } else {
                    forge = true;
                    if(!stack.hasTagCompound() || stack.getSubCompound("randores") == null || !stack.getSubCompound("randores").hasKey("furnace_speed")) {
                        return false;
                    }
                }
            } else if (this.upgrades.keySet().stream().noneMatch(k -> k.apply(stack))) {
                return false;
            }
            count++;
        }
    }
    return count >= 2 && forge;
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:25,代码来源:RandoresForgeUpgradeRecipe.java

示例15: getCraftingResult

import net.minecraft.inventory.InventoryCrafting; //导入依赖的package包/类
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
    double speed = 0;
    for (int i = 0; i < inv.getSizeInventory(); i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if(stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock() instanceof CraftiniumForge) {
            speed += stack.getSubCompound("randores").getInteger("furnace_speed");
        } else {
            speed += this.upgrades.entrySet().stream().filter(e -> e.getKey().apply(stack)).map(Entry::getValue).findFirst().orElse(0d);
        }
    }

    int intSpeed = (int) speed;
    if(intSpeed > this.clamp) {
        intSpeed = this.clamp;
    }

    ItemStack res = new ItemStack(CraftingBlocks.forgeItem);
    res.getOrCreateSubCompound("randores").setInteger("furnace_speed", intSpeed);
    return res;
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:22,代码来源:RandoresForgeUpgradeRecipe.java


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