本文整理汇总了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);
}