當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。