Expand World.spawnParticle API and add Builder
Adds ability to control who receives it and who is the source/sender (vanish API) the standard API is to send the packet to everyone in the world, which is ineffecient. This adds a new Builder API which is much friendlier to use.
This commit is contained in:
@@ -2948,7 +2948,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
* @param data the data to use for the particle or null,
|
||||
* the type of this depends on {@link Particle#getDataType()}
|
||||
*/
|
||||
public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data);
|
||||
public default <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) { spawnParticle(particle, null, null, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }// Paper start - Expand Particle API
|
||||
/**
|
||||
* Spawns the particle (the number of times specified by count)
|
||||
* at the target location. The position of each particle will be
|
||||
* randomized positively and negatively by the offset parameters
|
||||
* on each axis.
|
||||
*
|
||||
* @param particle the particle to spawn
|
||||
* @param receivers List of players to receive the particles, or null for all in world
|
||||
* @param source Source of the particles to be used in visibility checks, or null if no player source
|
||||
* @param x the position on the x axis to spawn at
|
||||
* @param y the position on the y axis to spawn at
|
||||
* @param z the position on the z axis to spawn at
|
||||
* @param count the number of particles
|
||||
* @param offsetX the maximum random offset on the X axis
|
||||
* @param offsetY the maximum random offset on the Y axis
|
||||
* @param offsetZ the maximum random offset on the Z axis
|
||||
* @param extra the extra data for this particle, depends on the
|
||||
* particle used (normally speed)
|
||||
* @param data the data to use for the particle or null,
|
||||
* the type of this depends on {@link Particle#getDataType()}
|
||||
* @param <T> Type
|
||||
*/
|
||||
public default <T> void spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @NotNull Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data) { spawnParticle(particle, receivers, source, x, y, z, count, offsetX, offsetY, offsetZ, extra, data, true); }
|
||||
/**
|
||||
* Spawns the particle (the number of times specified by count)
|
||||
* at the target location. The position of each particle will be
|
||||
* randomized positively and negatively by the offset parameters
|
||||
* on each axis.
|
||||
*
|
||||
* @param particle the particle to spawn
|
||||
* @param receivers List of players to receive the particles, or null for all in world
|
||||
* @param source Source of the particles to be used in visibility checks, or null if no player source
|
||||
* @param x the position on the x axis to spawn at
|
||||
* @param y the position on the y axis to spawn at
|
||||
* @param z the position on the z axis to spawn at
|
||||
* @param count the number of particles
|
||||
* @param offsetX the maximum random offset on the X axis
|
||||
* @param offsetY the maximum random offset on the Y axis
|
||||
* @param offsetZ the maximum random offset on the Z axis
|
||||
* @param extra the extra data for this particle, depends on the
|
||||
* particle used (normally speed)
|
||||
* @param data the data to use for the particle or null,
|
||||
* the type of this depends on {@link Particle#getDataType()}
|
||||
* @param <T> Type
|
||||
* @param force allows the particle to be seen further away from the player
|
||||
* and shows to players using any vanilla client particle settings
|
||||
*/
|
||||
public <T> void spawnParticle(@NotNull Particle particle, @Nullable List<Player> receivers, @Nullable Player source, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force);
|
||||
// Paper end
|
||||
|
||||
|
||||
/**
|
||||
* Spawns the particle (the number of times specified by count)
|
||||
|
||||
Reference in New Issue
Block a user