当前位置: 首页>>代码示例>>Java>>正文


Java EnchantmentHelper.getLootingModifier方法代码示例

本文整理汇总了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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:25,代码来源:LootingEnchantBonus.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:RandomChanceWithLooting.java

示例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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:43,代码来源:EntityLivingBase.java

示例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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:14,代码来源:ForgeHooks.java

示例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);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:45,代码来源:EntityLivingBase.java


注:本文中的net.minecraft.enchantment.EnchantmentHelper.getLootingModifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。