當前位置: 首頁>>代碼示例>>Java>>正文


Java Item.getMaxDamage方法代碼示例

本文整理匯總了Java中net.minecraft.item.Item.getMaxDamage方法的典型用法代碼示例。如果您正苦於以下問題:Java Item.getMaxDamage方法的具體用法?Java Item.getMaxDamage怎麽用?Java Item.getMaxDamage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.item.Item的用法示例。


在下文中一共展示了Item.getMaxDamage方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: registerAmmoRecipe

import net.minecraft.item.Item; //導入方法依賴的package包/類
public static void registerAmmoRecipe(Class<? extends _AmmoBase> ammoBase, Item weapon)
{
	ArrayList list = new ArrayList();
	
	Item ammo = getAmmoByClass(ammoBase);
	
	ItemStack weaponStack = new ItemStack(weapon, 1, weapon.getMaxDamage());
	ItemStack ammoStack = new ItemStack(ammo);
	
	list.add(weaponStack);
	list.add(ammoStack);
	
	GameRegistry.addRecipe(new Recipe_Ammo(ammo, weapon, list));
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:15,代碼來源:Helper.java

示例2: smeltItem

import net.minecraft.item.Item; //導入方法依賴的package包/類
public void smeltItem() {
	if((Boolean) canSmelt()[1]) {
		Item tool = machineItemStacks[0].getItem();
		int durability = tool.getMaxDamage() - tool.getDamage(machineItemStacks[0]);
		int newDurability = tool.getMaxDamage() / 3 + durability;
		if(newDurability > tool.getMaxDamage())
			newDurability = tool.getMaxDamage();
		machineItemStacks[0].setItemDamage(tool.getMaxDamage() - newDurability);
		machineItemStacks[1].stackSize--;
		if(machineItemStacks[1].stackSize <= 0)
			machineItemStacks[1] = null;
	}
}
 
開發者ID:viddeno,項目名稱:Technical,代碼行數:14,代碼來源:TileEntityMachineRepairingForge.java

示例3: getCraftingResult

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

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

        if (itemstack != null)
        {
            list.add(itemstack);

            if (list.size() > 1)
            {
                ItemStack itemstack1 = (ItemStack)list.get(0);

                if (itemstack.getItem() != itemstack1.getItem() || itemstack1.stackSize != 1 || itemstack.stackSize != 1 || !itemstack1.getItem().isDamageable())
                {
                    return null;
                }
            }
        }
    }

    if (list.size() == 2)
    {
        ItemStack itemstack2 = (ItemStack)list.get(0);
        ItemStack itemstack3 = (ItemStack)list.get(1);

        if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.stackSize == 1 && itemstack3.stackSize == 1 && itemstack2.getItem().isDamageable())
        {
            Item item = itemstack2.getItem();
            int j = item.getMaxDamage() - itemstack2.getItemDamage();
            int k = item.getMaxDamage() - itemstack3.getItemDamage();
            int l = j + k + item.getMaxDamage() * 5 / 100;
            int i1 = item.getMaxDamage() - l;

            if (i1 < 0)
            {
                i1 = 0;
            }

            return new ItemStack(itemstack2.getItem(), 1, i1);
        }
    }

    return null;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:52,代碼來源:RecipeRepairItem.java

示例4: getItemDmgCap

import net.minecraft.item.Item; //導入方法依賴的package包/類
public static int getItemDmgCap(Item item) {
    return item.getMaxDamage();
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:4,代碼來源:ZWrapper.java

示例5: getCraftingResult

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * Returns an Item that is the result of this recipe
 */
public ItemStack getCraftingResult(InventoryCrafting inv)
{
    List<ItemStack> list = Lists.<ItemStack>newArrayList();

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

        if (!itemstack.func_190926_b())
        {
            list.add(itemstack);

            if (list.size() > 1)
            {
                ItemStack itemstack1 = (ItemStack)list.get(0);

                if (itemstack.getItem() != itemstack1.getItem() || itemstack1.func_190916_E() != 1 || itemstack.func_190916_E() != 1 || !itemstack1.getItem().isDamageable())
                {
                    return ItemStack.field_190927_a;
                }
            }
        }
    }

    if (list.size() == 2)
    {
        ItemStack itemstack2 = (ItemStack)list.get(0);
        ItemStack itemstack3 = (ItemStack)list.get(1);

        if (itemstack2.getItem() == itemstack3.getItem() && itemstack2.func_190916_E() == 1 && itemstack3.func_190916_E() == 1 && itemstack2.getItem().isDamageable())
        {
            Item item = itemstack2.getItem();
            int j = item.getMaxDamage() - itemstack2.getItemDamage();
            int k = item.getMaxDamage() - itemstack3.getItemDamage();
            int l = j + k + item.getMaxDamage() * 5 / 100;
            int i1 = item.getMaxDamage() - l;

            if (i1 < 0)
            {
                i1 = 0;
            }

            return new ItemStack(itemstack2.getItem(), 1, i1);
        }
    }

    return ItemStack.field_190927_a;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:52,代碼來源:RecipeRepairItem.java

示例6: findMatchingRecipeResult

import net.minecraft.item.Item; //導入方法依賴的package包/類
public ItemStack findMatchingRecipeResult(InventoryCrafting crafting,
	InventoryWorkbenchAdditionalMaterials materials, World world)
{
	int i = 0;
	ItemStack itemstack = null;
	ItemStack itemstack1 = null;
	int j;

	for (j = 0; j < crafting.getSizeInventory(); ++j)
	{
		ItemStack itemstack2 = crafting.getStackInSlot(j);

		if (itemstack2 != null)
		{
			if (i == 0)
			{
				itemstack = itemstack2;
			}

			if (i == 1)
			{
				itemstack1 = itemstack2;
			}

			++i;
		}
	}

	if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.getCount() == 1 &&
			itemstack1.getCount() == 1 && itemstack.getItem().isRepairable())
	{
		Item item = itemstack.getItem();
		int j1 = item.getMaxDamage(itemstack) - itemstack.getItemDamage();
		int k = item.getMaxDamage(itemstack) - itemstack1.getItemDamage();
		int l = j1 + k + item.getMaxDamage(itemstack) * 5 / 100;
		int i1 = item.getMaxDamage(itemstack) - l;

		if (i1 < 0)
		{
			i1 = 0;
		}

		return new ItemStack(itemstack.getItem(), 1, i1);
	}
	else
	{
		for (j = 0; j < recipes.size(); ++j)
		{
			AdvancedRecipe advrecipe = recipes.get(j);

			if (advrecipe.matches(crafting, materials, world))
			{
				return advrecipe.getCraftingResult(crafting);
			}
		}

		return null;
	}
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:60,代碼來源:AdvancedCraftingHandler.java

示例7: findMatchingRecipe

import net.minecraft.item.Item; //導入方法依賴的package包/類
public AdvancedRecipe findMatchingRecipe(InventoryCrafting crafting,
	InventoryWorkbenchAdditionalMaterials materials, World world)
{
	int i = 0;
	ItemStack itemstack = null;
	ItemStack itemstack1 = null;
	int j;

	for (j = 0; j < crafting.getSizeInventory(); ++j)
	{
		ItemStack itemstack2 = crafting.getStackInSlot(j);

		if (itemstack2 != null)
		{
			if (i == 0)
			{
				itemstack = itemstack2;
			}

			if (i == 1)
			{
				itemstack1 = itemstack2;
			}

			++i;
		}
	}

	if (i == 2 && itemstack.getItem() == itemstack1.getItem() && itemstack.getCount() == 1 &&
		itemstack1.getCount() == 1 && itemstack.getItem().isRepairable())
	{
		Item item = itemstack.getItem();
		int j1 = item.getMaxDamage(itemstack) - itemstack.getItemDamage();
		int k = item.getMaxDamage(itemstack) - itemstack1.getItemDamage();
		int l = j1 + k + item.getMaxDamage(itemstack) * 5 / 100;
		int i1 = item.getMaxDamage(itemstack) - l;

		if (i1 < 0)
		{
			i1 = 0;
		}

		return null;
	}
	else
	{
		for (j = 0; j < recipes.size(); ++j)
		{
			AdvancedRecipe advrecipe = recipes.get(j);

			if (advrecipe.matches(crafting, materials, world))
			{
				return advrecipe;
			}
		}

		return null;
	}
}
 
開發者ID:einsteinsci,項目名稱:BetterBeginningsReborn,代碼行數:60,代碼來源:AdvancedCraftingHandler.java


注:本文中的net.minecraft.item.Item.getMaxDamage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。