本文整理汇总了Java中net.minecraft.enchantment.EnchantmentDurability类的典型用法代码示例。如果您正苦于以下问题:Java EnchantmentDurability类的具体用法?Java EnchantmentDurability怎么用?Java EnchantmentDurability使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EnchantmentDurability类属于net.minecraft.enchantment包,在下文中一共展示了EnchantmentDurability类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
/**
* Attempts to damage the ItemStack with par1 amount of damage, If the
* ItemStack has the Unbreaking enchantment there is a chance for each point
* of damage to be negated. Returns true if it takes more damage than
* getMaxDamage(). Returns false otherwise or if the ItemStack can't be
* damaged or if all points of damage are negated.
*/
public boolean attemptDamageItem(ItemStack stack, int amount, Random rand) {
if (amount > 0) {
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, stack);
int j = 0;
for (int k = 0;i > 0 && k < amount;++k) {
if (EnchantmentDurability.negateDamage(stack, i, rand)) {
++j;
}
}
amount -= j;
if (amount <= 0) { return false; }
}
setItemDamage(stack, getItemDamage(stack) + amount); // Redirect through
// Item's
// callback if
// applicable.
return getItemDamage(stack) > getDurability(stack);
}
开发者ID:tom5454,项目名称:Toms-Mod,代码行数:30,代码来源:ItemDamagableCrafting.java
示例2: func_96631_a
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_) {
if(!this.func_77984_f()) {
return false;
} else {
if(p_96631_1_ > 0) {
int var3 = EnchantmentHelper.func_77506_a(Enchantment.field_77347_r.field_77352_x, this);
int var4 = 0;
for(int var5 = 0; var3 > 0 && var5 < p_96631_1_; ++var5) {
if(EnchantmentDurability.func_92097_a(this, var3, p_96631_2_)) {
++var4;
}
}
p_96631_1_ -= var4;
if(p_96631_1_ <= 0) {
return false;
}
}
this.field_77991_e += p_96631_1_;
return this.field_77991_e > this.func_77958_k();
}
}
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:ItemStack.java
示例3: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
public static boolean attemptDamageItem(ItemStack stack, int damage, Random rand) {
if(!isItemStackDamageable(stack)) {
return false;
} else {
if(damage > 0) {
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack);
int k = 0;
for(int l = 0; j > 0 && l < damage; ++l) {
if(EnchantmentDurability.negateDamage(stack, j, rand)) {
k++;
}
}
damage -= k;
if(damage <= 0) {
return false;
}
}
stack.setItemDamage(stack.getItemDamage() + damage);
return stack.getItemDamage() > stack.getMaxDamage();
}
}
开发者ID:AgeCraft,项目名称:AgeCraft-Old,代码行数:22,代码来源:ACUtil.java
示例4: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
/**
* Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment
* there is a chance for each point of damage to be negated. Returns true if it takes more damage than
* getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are
* negated.
*/
public boolean attemptDamageItem(int amount, Random rand)
{
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (amount > 0)
{
int i = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this);
int j = 0;
for (int k = 0; i > 0 && k < amount; ++k)
{
if (EnchantmentDurability.negateDamage(this, i, rand))
{
++j;
}
}
amount -= j;
if (amount <= 0)
{
return false;
}
}
this.itemDamage += amount;
return this.itemDamage > this.getMaxDamage();
}
}
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:ItemStack.java
示例5: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
/**
* Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment
* there is a chance for each point of damage to be negated. Returns true if it takes more damage than
* getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are
* negated.
*/
public boolean attemptDamageItem(int amount, Random rand)
{
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (amount > 0)
{
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, this);
int j = 0;
for (int k = 0; i > 0 && k < amount; ++k)
{
if (EnchantmentDurability.negateDamage(this, i, rand))
{
++j;
}
}
amount -= j;
if (amount <= 0)
{
return false;
}
}
this.itemDamage += amount;
return this.itemDamage > this.getMaxDamage();
}
}
开发者ID:sudofox,项目名称:Backmemed,代码行数:40,代码来源:ItemStack.java
示例6: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
/**
* Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment
* there is a chance for each point of damage to be negated. Returns true if it takes more damage than
* getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are
* negated.
*/
public boolean attemptDamageItem(int amount, Random rand)
{
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (amount > 0)
{
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.UNBREAKING, this);
int j = 0;
for (int k = 0; i > 0 && k < amount; ++k)
{
if (EnchantmentDurability.negateDamage(this, i, rand))
{
++j;
}
}
amount -= j;
if (amount <= 0)
{
return false;
}
}
setItemDamage(getItemDamage() + amount); //Redirect through Item's callback if applicable.
return getItemDamage() > getMaxDamage();
}
}
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:40,代码来源:ItemStack.java
示例7: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
/**
* Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment
* there is a chance for each point of damage to be negated. Returns true if it takes more damage than
* getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are
* negated.
*/
public boolean attemptDamageItem(int par1, Random par2Random)
{
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (par1 > 0)
{
int var3 = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this);
int var4 = 0;
for (int var5 = 0; var3 > 0 && var5 < par1; ++var5)
{
if (EnchantmentDurability.negateDamage(this, var3, par2Random))
{
++var4;
}
}
par1 -= var4;
if (par1 <= 0)
{
return false;
}
}
this.itemDamage += par1;
return this.itemDamage > this.getMaxDamage();
}
}
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:40,代码来源:ItemStack.java
示例8: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
public boolean attemptDamageItem(int p_96631_1_, Random p_96631_2_)
{
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (p_96631_1_ > 0)
{
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this);
int k = 0;
for (int l = 0; j > 0 && l < p_96631_1_; ++l)
{
if (EnchantmentDurability.negateDamage(this, j, p_96631_2_))
{
++k;
}
}
p_96631_1_ -= k;
if (p_96631_1_ <= 0)
{
return false;
}
}
setItemDamage(getItemDamage() + p_96631_1_); //Redirect through Item's callback if applicable.
return getItemDamage() > getMaxDamage();
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:34,代码来源:ItemStack.java
示例9: attemptNBTDamage
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
private boolean attemptNBTDamage(ItemStack stack, int damage, Random rand) {
if (!this.isItemStackNBTDamageable(stack))
{
return false;
}
else
{
if (damage > 0)
{
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, stack);
int k = 0;
for (int l = 0; j > 0 && l < damage; ++l)
{
if (EnchantmentDurability.negateDamage(stack, j, rand))
{
++k;
}
}
damage -= k;
if (damage <= 0)
{
return false;
}
}
setNBTDamage(stack, getNBTDamage(stack) + damage);
return getNBTDamage(stack) > getNBTMaxDamage(stack);
}
}
开发者ID:TTFTCUTS,项目名称:ShadowsOfPhysis,代码行数:34,代码来源:ItemPhysisNBTDamage.java
示例10: attemptDamageItem
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
/**
* Attempts to damage the ItemStack with par1 amount of damage, If the ItemStack has the Unbreaking enchantment
* there is a chance for each point of damage to be negated. Returns true if it takes more damage than
* getMaxDamage(). Returns false otherwise or if the ItemStack can't be damaged or if all points of damage are
* negated.
*/
public boolean attemptDamageItem(int par1, Random par2Random)
{
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (par1 > 0)
{
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this);
int k = 0;
for (int l = 0; j > 0 && l < par1; ++l)
{
if (EnchantmentDurability.negateDamage(this, j, par2Random))
{
++k;
}
}
par1 -= k;
if (par1 <= 0)
{
return false;
}
}
setItemDamage(getItemDamage() + par1); //Redirect through Item's callback if applicable.
return getItemDamage() > getMaxDamage();
}
}
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:40,代码来源:ItemStack.java
示例11: isDamaged
import net.minecraft.enchantment.EnchantmentDurability; //导入依赖的package包/类
public boolean isDamaged(int p_96631_1_, Random p_96631_2_, EntityLivingBase entitylivingbase)
{
// Spigot end
if (!this.isItemStackDamageable())
{
return false;
}
else
{
if (p_96631_1_ > 0)
{
int j = EnchantmentHelper.getEnchantmentLevel(Enchantment.unbreaking.effectId, this);
int k = 0;
for (int l = 0; j > 0 && l < p_96631_1_; ++l)
{
if (EnchantmentDurability.negateDamage(this, j, p_96631_2_))
{
++k;
}
}
p_96631_1_ -= k;
// Spigot start
if (entitylivingbase instanceof EntityPlayerMP)
{
org.bukkit.craftbukkit.inventory.CraftItemStack item = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this);
org.bukkit.event.player.PlayerItemDamageEvent event = new org.bukkit.event.player.PlayerItemDamageEvent((org.bukkit.entity.Player) entitylivingbase.getBukkitEntity(), item, p_96631_1_);
org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return false;
}
p_96631_1_ = event.getDamage();
}
// Spigot end
if (p_96631_1_ <= 0)
{
return false;
}
}
setItemDamage(getItemDamage() + p_96631_1_); //Redirect through Item's callback if applicable.
return getItemDamage() > getMaxDamage();
}
}
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:52,代码来源:ItemStack.java
注:本文中的net.minecraft.enchantment.EnchantmentDurability类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论