cn.nukkit.level.particle.Particle Java Examples
The following examples show how to use
cn.nukkit.level.particle.Particle.
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: Level.java From Jupiter with GNU General Public License v3.0 | 6 votes |
public void addParticle(Particle particle, Player[] players) { DataPacket[] packets = particle.encode(); if (players == null) { if (packets != null) { for (DataPacket packet : packets) { this.addChunkPacket((int) particle.x >> 4, (int) particle.z >> 4, packet); } } } else { if (packets != null) { if (packets.length == 1) { Server.broadcastPacket(players, packets[0]); } else { this.server.batchPackets(players, packets, false); } } } }
Example #2
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void addParticle(Particle particle, Player[] players) { DataPacket[] packets = particle.encode(); if (players == null) { if (packets != null) { for (DataPacket packet : packets) { this.addChunkPacket((int) particle.x >> 4, (int) particle.z >> 4, packet); } } } else { if (packets != null) { if (packets.length == 1) { Server.broadcastPacket(players, packets[0]); } else { this.server.batchPackets(players, packets, false); } } } }
Example #3
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 6 votes |
public void addParticle(Particle particle, Player[] players) { DataPacket[] packets = particle.encode(); if (players == null) { if (packets != null) { for (DataPacket packet : packets) { this.addChunkPacket((int) particle.x >> 4, (int) particle.z >> 4, packet); } } } else { if (packets != null) { if (packets.length == 1) { Server.broadcastPacket(players, packets[0]); } else { this.server.batchPackets(players, packets, false); } } } }
Example #4
Source File: EntityExpBottle.java From Jupiter with GNU General Public License v3.0 | 5 votes |
@Override public boolean onUpdate(int currentTick) { if (this.closed) { return false; } this.timing.startTiming(); int tickDiff = currentTick - this.lastUpdate; boolean hasUpdate = super.onUpdate(currentTick); if (this.age > 1200) { this.kill(); hasUpdate = true; } if (this.isCollided) { this.kill(); Particle particle1 = new EnchantParticle(this); this.getLevel().addParticle(particle1); Particle particle2 = new SpellParticle(this, 0x00385dc6); this.getLevel().addParticle(particle2); hasUpdate = true; NukkitRandom random = new NukkitRandom(); int add = 1; for (int ii = 1; ii <= random.nextRange(3, 11); ii += add) { getLevel().dropExpOrb(this, add); add = random.nextRange(1, 3); } } this.timing.stopTiming(); return hasUpdate; }
Example #5
Source File: EntityExpBottle.java From Nukkit with GNU General Public License v3.0 | 5 votes |
public void dropXp() { Particle particle1 = new EnchantParticle(this); this.getLevel().addParticle(particle1); Particle particle2 = new SpellParticle(this, 0x00385dc6); this.getLevel().addParticle(particle2); this.getLevel().dropExpOrb(this, ThreadLocalRandom.current().nextInt(3, 12)); }
Example #6
Source File: EntityExpBottle.java From Nukkit with GNU General Public License v3.0 | 5 votes |
@Override public boolean onUpdate(int currentTick) { if (this.closed) { return false; } this.timing.startTiming(); int tickDiff = currentTick - this.lastUpdate; boolean hasUpdate = super.onUpdate(currentTick); if (this.age > 1200) { this.kill(); hasUpdate = true; } if (this.isCollided) { this.kill(); Particle particle1 = new EnchantParticle(this); this.getLevel().addParticle(particle1); Particle particle2 = new SpellParticle(this, 0x00385dc6); this.getLevel().addParticle(particle2); hasUpdate = true; NukkitRandom random = new NukkitRandom(); int add = 1; for (int ii = 1; ii <= random.nextRange(3, 11); ii += add) { getLevel().dropExpOrb(this, add); add = random.nextRange(1, 3); } } this.timing.stopTiming(); return hasUpdate; }
Example #7
Source File: Level.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle) { this.addParticle(particle, (Player[]) null); }
Example #8
Source File: Level.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle, Player player) { this.addParticle(particle, new Player[]{player}); }
Example #9
Source File: Level.java From Jupiter with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle, Collection<Player> players) { this.addParticle(particle, players.stream().toArray(Player[]::new)); }
Example #10
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle) { this.addParticle(particle, (Player[]) null); }
Example #11
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle, Player player) { this.addParticle(particle, new Player[]{player}); }
Example #12
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle, Collection<Player> players) { this.addParticle(particle, players.toArray(new Player[0])); }
Example #13
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle) { this.addParticle(particle, (Player[]) null); }
Example #14
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle, Player player) { this.addParticle(particle, new Player[]{player}); }
Example #15
Source File: Level.java From Nukkit with GNU General Public License v3.0 | 4 votes |
public void addParticle(Particle particle, Collection<Player> players) { this.addParticle(particle, players.stream().toArray(Player[]::new)); }