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


Java EntityPlayer.addPotionEffect方法代码示例

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


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

示例1: onFoodEaten

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player)
{
    if (!worldIn.isRemote)
    {
        player.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 0));
    }

    if (stack.getMetadata() > 0)
    {
        if (!worldIn.isRemote)
        {
            player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 4));
            player.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
            player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
        }
    }
    else
    {
        super.onFoodEaten(stack, worldIn, player);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:22,代码来源:ItemAppleGold.java

示例2: songEnded

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void songEnded(EntityPlayer player, ItemStack instrument, int interval) {
	World world = player.world;
	int radius = 15;
	AxisAlignedBB area = new AxisAlignedBB(player.posX - radius, player.posY - radius, player.posZ - radius,
			player.posX + radius, player.posY + radius, player.posZ + radius);
	List<Entity> mobs = world.getEntitiesWithinAABBExcludingEntity(player, area);
	for (Entity e : mobs) {
		if (e instanceof EntityLivingBase) {
			String key = EntityList.getEntityString(e);

			if (effects.containsKey(key)) {
				Potion p = effects.get(key);
				PotionEffect effect = new PotionEffect(p, (interval) * 20 * 6000);
				player.addPotionEffect(effect);
				return;
			}
		}
	}
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:21,代码来源:SongHunt.java

示例3: update

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void update(EntityPlayer player, float healthPerMax) {
    if (!this.isEnabled.getAsBoolean()) return;
    if (activeMultiplier == 0) {
        ticks = 0;
    } else {
        if (ticks == 0) {
            if (healthPerMax != -1)
                syncMultiplier(healthPerMax); //There are apparently some cases where the multiplier does not sync up right... fix this
            if (activeMultiplier != 0)
                player.addPotionEffect(new PotionEffect(effect, 240, activeMultiplier - 1, false, false));
        }
        ticks++;
        if (ticks >= 200) ticks = 0;
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:17,代码来源:ConstantDebuff.java

示例4: PlayerDeath

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@HarshenEvent
public void PlayerDeath(LivingDeathEvent event)
{
	EntityPlayer player = (EntityPlayer) event.getEntity();
	event.setCanceled(true);
	if (player instanceof EntityPlayerMP)
	{
           EntityPlayerMP entityplayermp = (EntityPlayerMP)player;
           entityplayermp.addStat(StatList.getObjectUseStats(Items.TOTEM_OF_UNDYING));
           CriteriaTriggers.USED_TOTEM.trigger(entityplayermp, HarshenUtils.getFirstOccuringItem(player, Items.TOTEM_OF_UNDYING));
       }
	
	HarshenUtils.setStackInSlot(player, Items.TOTEM_OF_UNDYING, ItemStack.EMPTY);
	player.setHealth(1.0F);
	player.clearActivePotions();
	player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 900, 1));
	player.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 100, 1));
	player.world.setEntityState(player, (byte)35);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:20,代码来源:HandlerTotemOfUndying.java

示例5: handleUpkeepEvent

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void handleUpkeepEvent(int numChanges, EntityLiving entity) {
    if(entity.getAttackTarget() instanceof EntityPlayer && entity.canEntityBeSeen(entity.getAttackTarget())){
        EntityPlayer player = (EntityPlayer)entity.getAttackTarget();
        player.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS,MobUpkeepController.POTION_EFFECT_LENGTH,numChanges,false,true));
    }
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:8,代码来源:WeakGazeModifier.java

示例6: onItemUseFinish

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
 * the Item before the action is complete.
 */
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityPlayer playerIn)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --stack.stackSize;
    }

    if (!worldIn.isRemote)
    {
        List<PotionEffect> list = this.getEffects(stack);

        if (list != null)
        {
            for (PotionEffect potioneffect : list)
            {
                playerIn.addPotionEffect(new PotionEffect(potioneffect));
            }
        }
    }

    playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);

    if (!playerIn.capabilities.isCreativeMode)
    {
        if (stack.stackSize <= 0)
        {
            return new ItemStack(Items.glass_bottle);
        }

        playerIn.inventory.addItemStackToInventory(new ItemStack(Items.glass_bottle));
    }

    return stack;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:39,代码来源:ItemPotion.java

示例7: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick( World world, EntityPlayer living, EnumHand hand) {
	//if (!living.getCapability(TF2weapons.WEAPONS_CAP, null).effectsCool.containsKey("Charging")) {
	ItemStack stack=living.getHeldItem(hand);
		if (!world.isRemote)
			living.addPotionEffect(new PotionEffect(TF2weapons.charging, 40));
		living.getCooldownTracker().setCooldown(this, (int) (280f/TF2Attribute.getModifier("Charge Recharge", stack, 1, living)));
		//living.getCapability(TF2weapons.WEAPONS_CAP, null).effectsCool.put("Charging", 280);
	//}
	return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:12,代码来源:ItemChargingTarge.java

示例8: onDroppedByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player) {
        player.addPotionEffect(new PotionEffect(Potion.getPotionById(15), 100, 2));
        EntityLightningBolt lightningBolt = new EntityLightningBolt(player.world, 5, 5 ,5,false);
        lightningBolt.setPosition(player.posX, player.posY, player.posZ);
        player.world.spawnEntity(lightningBolt);
    return super.onDroppedByPlayer(item, player);
}
 
开发者ID:inifire201,项目名称:MagicWinds,代码行数:9,代码来源:ToolTestSword.java

示例9: addEffectsToPlayers

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void addEffectsToPlayers()
{
    if (this.isComplete && this.levels > 0 && !this.worldObj.isRemote && this.primaryEffect > 0)
    {
        double d0 = (double)(this.levels * 10 + 10);
        int i = 0;

        if (this.levels >= 4 && this.primaryEffect == this.secondaryEffect)
        {
            i = 1;
        }

        int j = this.pos.getX();
        int k = this.pos.getY();
        int l = this.pos.getZ();
        AxisAlignedBB axisalignedbb = (new AxisAlignedBB((double)j, (double)k, (double)l, (double)(j + 1), (double)(k + 1), (double)(l + 1))).expand(d0, d0, d0).addCoord(0.0D, (double)this.worldObj.getHeight(), 0.0D);
        List<EntityPlayer> list = this.worldObj.<EntityPlayer>getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);

        for (EntityPlayer entityplayer : list)
        {
            entityplayer.addPotionEffect(new PotionEffect(this.primaryEffect, 180, i, true, true));
        }

        if (this.levels >= 4 && this.primaryEffect != this.secondaryEffect && this.secondaryEffect > 0)
        {
            for (EntityPlayer entityplayer1 : list)
            {
                entityplayer1.addPotionEffect(new PotionEffect(this.secondaryEffect, 180, 0, true, true));
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:33,代码来源:TileEntityBeacon.java

示例10: onFoodEaten

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
	if (!worldIn.isRemote && potions != null) {
		final int modifier = isDry(stack) ? 160 : 80;
		for (Potion effect : potions) {
			player.addPotionEffect(new PotionEffect(effect, modifier, modifier / 80));
		}
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:10,代码来源:ItemCrop.java

示例11: addEffectsToPlayers

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void addEffectsToPlayers()
{
    if (this.isComplete && this.levels > 0 && !this.worldObj.isRemote && this.primaryEffect != null)
    {
        double d0 = (double)(this.levels * 10 + 10);
        int i = 0;

        if (this.levels >= 4 && this.primaryEffect == this.secondaryEffect)
        {
            i = 1;
        }

        int j = (9 + this.levels * 2) * 20;
        int k = this.pos.getX();
        int l = this.pos.getY();
        int i1 = this.pos.getZ();
        AxisAlignedBB axisalignedbb = (new AxisAlignedBB((double)k, (double)l, (double)i1, (double)(k + 1), (double)(l + 1), (double)(i1 + 1))).expandXyz(d0).addCoord(0.0D, (double)this.worldObj.getHeight(), 0.0D);
        List<EntityPlayer> list = this.worldObj.<EntityPlayer>getEntitiesWithinAABB(EntityPlayer.class, axisalignedbb);

        for (EntityPlayer entityplayer : list)
        {
            entityplayer.addPotionEffect(new PotionEffect(this.primaryEffect, j, i, true, true));
        }

        if (this.levels >= 4 && this.primaryEffect != this.secondaryEffect && this.secondaryEffect != null)
        {
            for (EntityPlayer entityplayer1 : list)
            {
                entityplayer1.addPotionEffect(new PotionEffect(this.secondaryEffect, j, 0, true, true));
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:34,代码来源:TileEntityBeacon.java

示例12: onFoodEaten

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player)
{
    if (!worldIn.isRemote)
    {
        
            player.addPotionEffect(new PotionEffect(MobEffects.GLOWING, 100, 0));
            player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, 310, 0));
            player.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 50, 0));
    }
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:11,代码来源:ZombieEye.java

示例13: songTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean songTick(EntityPlayer player, ItemStack instrument, int interval, int ticks, int length) {
	if (interval > 0) {
		player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, 2, 1));
	}
	return true;
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:8,代码来源:SongInvisible.java

示例14: onTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onTick(EntityPlayer player, int tick) {
	player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, 7, 0, false, false));
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:5,代码来源:OneRing.java

示例15: onFoodEaten

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
	player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 450, 0));
	player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 450, 0));
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:6,代码来源:ItemHoney.java


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