diff --git a/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch index 7f1685457b..94eae24f01 100644 --- a/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-API-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -5,13 +5,12 @@ Subject: [PATCH] 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. -Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java new file mode 100644 -index 000000000..feebfb653 +index 00000000..50b52d6b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java @@ -0,0 +0,0 @@ @@ -397,55 +396,44 @@ index 000000000..feebfb653 + + /** + * Sets the particle Color. -+ * Only valid for REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT. ++ * Only valid for REDSTONE. + * @param color the new particle color + * @return a reference to this object. + */ + public ParticleBuilder color(Color color) { -+ return color(color.getRed(), color.getGreen(), color.getBlue()); ++ return color(color, 1); ++ } ++ ++ /** ++ * Sets the particle Color and size. ++ * Only valid for REDSTONE. ++ * @param color the new particle color ++ * @param size the size of the particle ++ * @return a reference to this object. ++ */ ++ public ParticleBuilder color(Color color, float size) { ++ if (particle != Particle.REDSTONE) { ++ throw new IllegalStateException("Color may only be set on REDSTONE"); ++ } ++ return data(new Particle.DustOptions(color, size)); + } + + /** + * Sets the particle Color. -+ * Only valid for REDSTONE, SPELL_MOB and SPELL_MOB_AMBIENT. ++ * Only valid for REDSTONE. + * @param r red color component + * @param g green color component + * @param b blue color component + * @return a reference to this object. + */ + public ParticleBuilder color(int r, int g, int b) { -+ if (particle != Particle.REDSTONE && particle != Particle.SPELL_MOB && particle != Particle.SPELL_MOB_AMBIENT) { -+ throw new IllegalStateException("Color may only be set on REDSTONE, SPELL_MOB, or SPELL_MOB_AMBIENT"); -+ } -+ offsetX = convertColorValue(r); -+ offsetY = convertColorValue(g); -+ offsetZ = convertColorValue(b); -+ return this; -+ } -+ -+ private static double convertColorValue(double value) { -+ if (value <= 0.0D) { -+ value = -1.0D; -+ } -+ -+ return value / 255.0D; ++ return color(Color.fromRGB(r, g, b)); + } +} diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java -index 4d0acaf5b..255efab76 100644 +index 4d0acaf5..827aa00c 100644 --- a/src/main/java/org/bukkit/Particle.java +++ b/src/main/java/org/bukkit/Particle.java -@@ -0,0 +0,0 @@ public enum Particle { - SMOKE_LARGE, - SPELL, - SPELL_INSTANT, -- SPELL_MOB, -- SPELL_MOB_AMBIENT, -+ SPELL_MOB(DustOptions.class), // Paper -+ SPELL_MOB_AMBIENT(DustOptions.class), // Paper - SPELL_WITCH, - DRIP_WATER, - DRIP_LAVA, @@ -0,0 +0,0 @@ public enum Particle { return dataType; } @@ -464,7 +452,7 @@ index 4d0acaf5b..255efab76 100644 * Options which can be applied to redstone dust particles - a particle * color and size. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0fb55b071..a8d97c519 100644 +index 0fb55b07..a8d97c51 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {