/** * Spawns the desired particle and sends the necessary packets to the relevant connected players. */ public void spawnParticle(EnumParticleTypes particleType, boolean longDistance, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int... particleArguments) { SPacketParticles spacketparticles = new SPacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset, (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, particleArguments); for (int i = 0; i < this.playerEntities.size(); ++i) { EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntities.get(i); this.sendPacketWithinDistance(entityplayermp, longDistance, xCoord, yCoord, zCoord, spacketparticles); } }
/** * Spawns a specified number of particles at the specified location with a randomized displacement according to * specified bounds */ public void handleParticles(SPacketParticles packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (packetIn.getParticleCount() == 0) { double d0 = (double)(packetIn.getParticleSpeed() * packetIn.getXOffset()); double d2 = (double)(packetIn.getParticleSpeed() * packetIn.getYOffset()); double d4 = (double)(packetIn.getParticleSpeed() * packetIn.getZOffset()); try { this.clientWorldController.spawnParticle(packetIn.getParticleType(), packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArgs()); } catch (Throwable var17) { LOGGER.warn("Could not spawn particle effect {}", new Object[] {packetIn.getParticleType()}); } } else { for (int i = 0; i < packetIn.getParticleCount(); ++i) { double d1 = this.avRandomizer.nextGaussian() * (double)packetIn.getXOffset(); double d3 = this.avRandomizer.nextGaussian() * (double)packetIn.getYOffset(); double d5 = this.avRandomizer.nextGaussian() * (double)packetIn.getZOffset(); double d6 = this.avRandomizer.nextGaussian() * (double)packetIn.getParticleSpeed(); double d7 = this.avRandomizer.nextGaussian() * (double)packetIn.getParticleSpeed(); double d8 = this.avRandomizer.nextGaussian() * (double)packetIn.getParticleSpeed(); try { this.clientWorldController.spawnParticle(packetIn.getParticleType(), packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArgs()); } catch (Throwable var16) { LOGGER.warn("Could not spawn particle effect {}", new Object[] {packetIn.getParticleType()}); return; } } } }
public void spawnParticle(EntityPlayerMP player, EnumParticleTypes particle, boolean longDistance, double x, double y, double z, int count, double xOffset, double yOffset, double zOffset, double speed, int... arguments) { Packet<?> packet = new SPacketParticles(particle, longDistance, (float)x, (float)y, (float)z, (float)xOffset, (float)yOffset, (float)zOffset, (float)speed, count, arguments); this.sendPacketWithinDistance(player, longDistance, x, y, z, packet); }
private static void emitSmoke(WorldServer world, double x, double y, double z) { SPacketParticles packet = new SPacketParticles(EnumParticleTypes.SMOKE_LARGE, false, (float) x, (float) y, (float) z, 0f, 0.5f, 0f, 0.0f, 10); dispatch(world, packet); }
private static void emitEnder(WorldServer world, double x, double y, double z) { SPacketParticles packet = new SPacketParticles(EnumParticleTypes.PORTAL, false, (float) x, (float) y, (float) z, 0.5f, 0.5f, 0.5f, 1.0f, 50); dispatch(world, packet); }
private static void dispatch(WorldServer world, SPacketParticles packet) { //fix later, not needed right now //for (Object o : world.playerEntities) // ((EntityPlayerMP) o).mcServer.getEntityWorld().sendPacketToServer(packet); }
/** * Spawns a specified number of particles at the specified location with a randomized displacement according to * specified bounds */ void handleParticles(SPacketParticles packetIn);