本文整理匯總了Java中net.minecraft.enchantment.EnchantmentHelper.getLootingModifier方法的典型用法代碼示例。如果您正苦於以下問題:Java EnchantmentHelper.getLootingModifier方法的具體用法?Java EnchantmentHelper.getLootingModifier怎麽用?Java EnchantmentHelper.getLootingModifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.enchantment.EnchantmentHelper
的用法示例。
在下文中一共展示了EnchantmentHelper.getLootingModifier方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: apply
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
public ItemStack apply(ItemStack stack, Random rand, LootContext context)
{
Entity entity = context.getKiller();
if (entity instanceof EntityLivingBase)
{
int i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);
if (i == 0)
{
return stack;
}
float f = (float)i * this.count.generateFloat(rand);
stack.func_190917_f(Math.round(f));
if (this.limit != 0 && stack.func_190916_E() > this.limit)
{
stack.func_190920_e(this.limit);
}
}
return stack;
}
示例2: testCondition
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
public boolean testCondition(Random rand, LootContext context)
{
int i = 0;
if (context.getKiller() instanceof EntityLivingBase)
{
i = EnchantmentHelper.getLootingModifier((EntityLivingBase)context.getKiller());
}
return rand.nextFloat() < this.chance + (float)i * this.lootingMultiplier;
}
示例3: onDeath
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
/**
* Called when the mob's health reaches 0.
*/
public void onDeath(DamageSource cause)
{
if (!this.dead)
{
Entity entity = cause.getEntity();
EntityLivingBase entitylivingbase = this.getAttackingEntity();
if (this.scoreValue >= 0 && entitylivingbase != null)
{
entitylivingbase.addToPlayerScore(this, this.scoreValue);
}
if (entity != null)
{
entity.onKillEntity(this);
}
this.dead = true;
this.getCombatTracker().reset();
if (!this.world.isRemote)
{
int i = 0;
if (entity instanceof EntityPlayer)
{
i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);
}
if (this.canDropLoot() && this.world.getGameRules().getBoolean("doMobLoot"))
{
boolean flag = this.recentlyHit > 0;
this.dropLoot(flag, i, cause);
}
}
this.world.setEntityState(this, (byte)3);
}
}
示例4: getLootingLevel
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
public static int getLootingLevel(Entity target, Entity killer, DamageSource cause)
{
int looting = 0;
if (killer instanceof EntityLivingBase)
{
looting = EnchantmentHelper.getLootingModifier((EntityLivingBase)killer);
}
if (target instanceof EntityLivingBase)
{
looting = getLootingLevel((EntityLivingBase)target, cause, looting);
}
return looting;
}
示例5: onDeath
import net.minecraft.enchantment.EnchantmentHelper; //導入方法依賴的package包/類
/**
* Called when the mob's health reaches 0.
*/
public void onDeath(DamageSource cause)
{
Entity entity = cause.getEntity();
EntityLivingBase entitylivingbase = this.func_94060_bK();
if (this.scoreValue >= 0 && entitylivingbase != null)
{
entitylivingbase.addToPlayerScore(this, this.scoreValue);
}
if (entity != null)
{
entity.onKillEntity(this);
}
this.dead = true;
this.getCombatTracker().reset();
if (!this.worldObj.isRemote)
{
int i = 0;
if (entity instanceof EntityPlayer)
{
i = EnchantmentHelper.getLootingModifier((EntityLivingBase)entity);
}
if (this.canDropLoot() && this.worldObj.getGameRules().getBoolean("doMobLoot"))
{
this.dropFewItems(this.recentlyHit > 0, i);
this.dropEquipment(this.recentlyHit > 0, i);
if (this.recentlyHit > 0 && this.rand.nextFloat() < 0.025F + (float)i * 0.01F)
{
this.addRandomDrop();
}
}
}
this.worldObj.setEntityState(this, (byte)3);
}