当前位置: 首页>>代码示例>>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;未经允许,请勿转载。