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


Java Effect.getId方法代码示例

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


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

示例1: addEffect

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
public void addEffect(Effect effect) {
    if (effect == null) {
        return; //here add null means add nothing
    }

    Effect oldEffect = this.effects.getOrDefault(effect.getId(), null);
    if (oldEffect != null) {
        if (Math.abs(effect.getAmplifier()) < Math.abs(oldEffect.getAmplifier())) return;
        if (Math.abs(effect.getAmplifier()) == Math.abs(oldEffect.getAmplifier())
                && effect.getDuration() < oldEffect.getDuration()) return;
        effect.add(this, true);
    } else {
        effect.add(this, false);
    }

    this.effects.put(effect.getId(), effect);

    this.recalculateEffectColor();

    if (effect.getId() == Effect.HEALTH_BOOST) {
        this.setHealth(this.getHealth() + 4 * (effect.getAmplifier() + 1));
    }

}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:25,代码来源:Entity.java

示例2: addEffect

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
public void addEffect(Effect effect) {
    if (effect == null) {
        return; //here add null means add nothing
    }

    Effect oldEffect = this.effects.getOrDefault(effect.getId(), null);
    if (oldEffect != null) {
        if (Math.abs(effect.getAmplifier()) < Math.abs(oldEffect.getAmplifier())) {
            return;
        }
        if (Math.abs(effect.getAmplifier()) == Math.abs(oldEffect.getAmplifier())
                && effect.getDuration() < oldEffect.getDuration()) {
            return;
        }
        effect.add(this, true);
    } else {
        effect.add(this, false);
    }

    this.effects.put(effect.getId(), effect);

    this.recalculateEffectColor();

    if (effect.getId() == Effect.HEALTH_BOOST) {
        this.setHealth(this.getHealth() + 4 * (effect.getAmplifier() + 1));
    }

}
 
开发者ID:Nukkit,项目名称:Nukkit,代码行数:29,代码来源:Entity.java

示例3: sendPotionEffects

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
public void sendPotionEffects(Player player) {
    for (Effect effect : this.effects.values()) {
        MobEffectPacket pk = new MobEffectPacket();
        pk.eid = this.getId();
        pk.effectId = effect.getId();
        pk.amplifier = effect.getAmplifier();
        pk.particles = effect.isVisible();
        pk.duration = effect.getDuration();
        pk.eventId = MobEffectPacket.EVENT_ADD;

        player.dataPacket(pk);
    }
}
 
开发者ID:Rsplwe,项目名称:Nukkit-Java9,代码行数:14,代码来源:Entity.java

示例4: sendPotionEffects

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
public void sendPotionEffects(Player player) {
    for (Effect effect : this.effects.values()) {
        MobEffectPacket pk = new MobEffectPacket();
        pk.entityRuntimeId = this.getId();
        pk.effectId = effect.getId();
        pk.amplifier = effect.getAmplifier();
        pk.particles = effect.isVisible();
        pk.duration = effect.getDuration();
        pk.eventId = MobEffectPacket.EVENT_ADD;

        player.dataPacket(pk);
    }
}
 
开发者ID:JupiterDevelopmentTeam,项目名称:Jupiter,代码行数:14,代码来源:Entity.java

示例5: sendPotionEffects

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
public void sendPotionEffects(Player player) {
    for (Effect effect : this.effects.values()) {
        MobEffectPacket pk = new MobEffectPacket();
        pk.eid = player.getId();
        pk.effectId = effect.getId();
        pk.amplifier = effect.getAmplifier();
        pk.particles = effect.isVisible();
        pk.duration = effect.getDuration();
        pk.eventId = MobEffectPacket.EVENT_ADD;

        player.dataPacket(pk);
    }
}
 
开发者ID:FrontierDevs,项目名称:Jenisys3,代码行数:14,代码来源:Entity.java

示例6: sendPotionEffects

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
public void sendPotionEffects(Player player) {
    for (Effect effect : this.effects.values()) {
        MobEffectPacket pk = new MobEffectPacket();
        pk.eid = 0;
        pk.effectId = effect.getId();
        pk.amplifier = effect.getAmplifier();
        pk.particles = effect.isVisible();
        pk.duration = effect.getDuration();
        pk.eventId = MobEffectPacket.EVENT_ADD;

        player.dataPacket(pk);
    }
}
 
开发者ID:Creeperface01,项目名称:NukkitGT,代码行数:14,代码来源:Entity.java

示例7: hasPotionEffect

import cn.nukkit.potion.Effect; //导入方法依赖的package包/类
@Override
public boolean hasPotionEffect(PotionEffectType potionEffect) {
	Effect nukkitEffect = PokkitPotionEffectType.toNukkit(potionEffect);
	for (cn.nukkit.potion.Effect eff : nukkit.getEffects().values()) {
		if (eff.getId() == nukkitEffect.getId()) {
			return true;
		}
	}
	return false;
}
 
开发者ID:rutgerkok,项目名称:Pokkit,代码行数:11,代码来源:PokkitLivingEntity.java


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