本文整理匯總了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));
}
示例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;
}
}
示例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;
}
示例4: getItemDmgCap
import net.minecraft.item.Item; //導入方法依賴的package包/類
public static int getItemDmgCap(Item item) {
return item.getMaxDamage();
}
示例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;
}
示例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;
}
}
示例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;
}
}