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


Java EntityPlayer.isPotionActive方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.isPotionActive方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.isPotionActive方法的具体用法?Java EntityPlayer.isPotionActive怎么用?Java EntityPlayer.isPotionActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.isPotionActive方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyGlobalPotionModifiers

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Changed copy of the first part from {@link EnchantmentHelper#applyEnchantmentModifier(EnchantmentHelper.IModifier, ItemStack)}
 */
public static float applyGlobalPotionModifiers(EntityPlayer player, DamageSource source, float damage) {
    if (source.isDamageAbsolute())
        return damage;
    if (player.isPotionActive(MobEffects.RESISTANCE) && source != DamageSource.OUT_OF_WORLD) {
        @SuppressWarnings("ConstantConditions")
        int i = (player.getActivePotionEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
        int j = 25 - i;
        float f = damage * (float) j;
        damage = f / 25.0F;
    }

    if (damage <= 0.0F)
        return 0.0F;

    return damage;
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:20,代码来源:ArmorUtils.java

示例2: getPlayerCount

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public String getPlayerCount() {
    if (mc.theWorld == null) return "0";

    int players = 0;
    for (EntityPlayer player : mc.theWorld.playerEntities) {
        if (!player.isInvisibleToPlayer(mc.thePlayer) && !player.isPotionActive(14) && player.getUniqueID().toString().charAt(14) == '4') {
            players += 1;
        }
    }
    return String.valueOf(players);
}
 
开发者ID:boomboompower,项目名称:TextDisplayer,代码行数:12,代码来源:ServerParser.java

示例3: breakSpeed

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@SubscribeEvent
public void breakSpeed(PlayerEvent.BreakSpeed event){
    // Check if the break speed has been modified due to water
    // prevent the modification if there is lanolin on the tool being used
    // decrement the lanolin when the block is successfully broken
    EntityPlayer player = event.getEntityPlayer();
    IBlockState state = event.getState();
    BlockPos pos = event.getPos();
    if(player.isInsideOfMaterial(Material.WATER)) {
        //Player is inside water, check for lanolin
        if(player.getHeldItemMainhand().hasTagCompound() && player.getHeldItemMainhand().getTagCompound().hasKey("lanolin")){
            // Recalculate ala EntityPlayer.getDigSpeed(), but skip the water portion
            float f = player.inventory.getStrVsBlock(state);

            if (f > 1.0F)
            {
                int i = EnchantmentHelper.getEfficiencyModifier(player);
                ItemStack itemstack = player.getHeldItemMainhand();

                if (i > 0 && !itemstack.isEmpty())
                {
                    f += (float)(i * i + 1);
                }
            }

            if (player.isPotionActive(MobEffects.HASTE))
            {
                f *= 1.0F + (float)(player.getActivePotionEffect(MobEffects.HASTE).getAmplifier() + 1) * 0.2F;
            }

            if (player.isPotionActive(MobEffects.MINING_FATIGUE))
            {
                float f1;

                switch (player.getActivePotionEffect(MobEffects.MINING_FATIGUE).getAmplifier())
                {
                    case 0:
                        f1 = 0.3F;
                        break;
                    case 1:
                        f1 = 0.09F;
                        break;
                    case 2:
                        f1 = 0.0027F;
                        break;
                    case 3:
                    default:
                        f1 = 8.1E-4F;
                }

                f *= f1;
            }
            if(f > event.getNewSpeed()){
                event.setNewSpeed(f < 0 ? 0 : f);
            }
        }
    }
}
 
开发者ID:SirLyle,项目名称:Lanolin,代码行数:59,代码来源:EventHandlerCommon.java


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