Java Code Examples for cn.nukkit.potion.Effect#isVisible()
The following examples show how to use
cn.nukkit.potion.Effect#isVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 5 votes |
protected void recalculateEffectColor() { int[] color = new int[3]; int count = 0; boolean ambient = true; for (Effect effect : this.effects.values()) { if (effect.isVisible()) { int[] c = effect.getColor(); color[0] += c[0] * (effect.getAmplifier() + 1); color[1] += c[1] * (effect.getAmplifier() + 1); color[2] += c[2] * (effect.getAmplifier() + 1); count += effect.getAmplifier() + 1; if (!effect.isAmbient()) { ambient = false; } } } if (count > 0) { int r = (color[0] / count) & 0xff; int g = (color[1] / count) & 0xff; int b = (color[2] / count) & 0xff; this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, (r << 16) + (g << 8) + b)); this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, ambient ? 1 : 0)); } else { this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, 0)); this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, 0)); } }
Example 2
Source File: Entity.java From Jupiter with GNU General Public License v3.0 | 5 votes |
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); } }
Example 3
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 5 votes |
protected void recalculateEffectColor() { int[] color = new int[3]; int count = 0; boolean ambient = true; for (Effect effect : this.effects.values()) { if (effect.isVisible()) { int[] c = effect.getColor(); color[0] += c[0] * (effect.getAmplifier() + 1); color[1] += c[1] * (effect.getAmplifier() + 1); color[2] += c[2] * (effect.getAmplifier() + 1); count += effect.getAmplifier() + 1; if (!effect.isAmbient()) { ambient = false; } } } if (count > 0) { int r = (color[0] / count) & 0xff; int g = (color[1] / count) & 0xff; int b = (color[2] / count) & 0xff; this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, (r << 16) + (g << 8) + b)); this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, ambient ? 1 : 0)); } else { this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, 0)); this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, 0)); } }
Example 4
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 5 votes |
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); } }
Example 5
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 5 votes |
protected void recalculateEffectColor() { int[] color = new int[3]; int count = 0; boolean ambient = true; for (Effect effect : this.effects.values()) { if (effect.isVisible()) { int[] c = effect.getColor(); color[0] += c[0] * (effect.getAmplifier() + 1); color[1] += c[1] * (effect.getAmplifier() + 1); color[2] += c[2] * (effect.getAmplifier() + 1); count += effect.getAmplifier() + 1; if (!effect.isAmbient()) { ambient = false; } } } if (count > 0) { int r = (color[0] / count) & 0xff; int g = (color[1] / count) & 0xff; int b = (color[2] / count) & 0xff; this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, (r << 16) + (g << 8) + b)); this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, ambient ? 1 : 0)); } else { this.setDataProperty(new IntEntityData(Entity.DATA_POTION_COLOR, 0)); this.setDataProperty(new ByteEntityData(Entity.DATA_POTION_AMBIENT, 0)); } }
Example 6
Source File: Entity.java From Nukkit with GNU General Public License v3.0 | 5 votes |
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); } }