當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。