From e7b17b016d7643077c23fc203a1dd64052d441d0 Mon Sep 17 00:00:00 2001 From: Patrick Miller Date: Thu, 30 May 2024 03:56:43 -0400 Subject: [PATCH] Particle Compatibility Improvements (#6716) * first pass at updating lang entries * Rewrite Particle lang entries A lot of particles probably don't work though * Add a test * Fix block marker particles * Add support for multiple expressions in a particle pattern * first pass at new data suppliers * Fix a few issues related to new suppliers * Data supplier touchups * Fix broken particles --------- Co-authored-by: Moderocky --- .../njol/skript/util/visual/VisualEffect.java | 28 +- .../skript/util/visual/VisualEffects.java | 200 +++-- src/main/resources/lang/default.lang | 795 +++++++++++------- .../regressions/3284-itemcrack particle.sk | 2 +- .../tests/syntaxes/effects/EffVisualEffect.sk | 112 +++ 5 files changed, 760 insertions(+), 377 deletions(-) create mode 100644 src/test/skript/tests/syntaxes/effects/EffVisualEffect.sk diff --git a/src/main/java/ch/njol/skript/util/visual/VisualEffect.java b/src/main/java/ch/njol/skript/util/visual/VisualEffect.java index 194fd833bbe..7965ba5c722 100644 --- a/src/main/java/ch/njol/skript/util/visual/VisualEffect.java +++ b/src/main/java/ch/njol/skript/util/visual/VisualEffect.java @@ -23,10 +23,13 @@ import ch.njol.skript.lang.Expression; import ch.njol.skript.lang.SkriptParser.ParseResult; import ch.njol.skript.lang.SyntaxElement; +import ch.njol.skript.lang.util.ContextlessEvent; import ch.njol.util.Kleenean; import ch.njol.yggdrasil.YggdrasilSerializable; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Particle; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -36,8 +39,6 @@ public class VisualEffect implements SyntaxElement, YggdrasilSerializable { - private static final boolean HAS_REDSTONE_DATA = Skript.classExists("org.bukkit.Particle$DustOptions"); - private VisualEffectType type; @Nullable @@ -46,14 +47,29 @@ public class VisualEffect implements SyntaxElement, YggdrasilSerializable { private float dX, dY, dZ = 0f; public VisualEffect() {} - + @SuppressWarnings({"null", "ConstantConditions"}) @Override public boolean init(Expression[] exprs, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) { type = VisualEffects.get(matchedPattern); - if (exprs.length > 4 && exprs[0] != null) { - data = exprs[0].getSingle(null); + if (exprs.length > 4) { + int exprCount = exprs.length - 4; // some effects might have multiple expressions + ContextlessEvent event = ContextlessEvent.get(); + if (exprCount == 1) { + data = exprs[0] != null ? exprs[0].getSingle(event) : null; + } else { // provide an array of expression values + Object[] dataArray = new Object[exprCount]; + for (int i = 0; i < exprCount; i++) + dataArray[i] = exprs[i] != null ? exprs[i].getSingle(event) : null; + data = dataArray; + } + } + + if (parseResult.hasTag("barrierbm")) { // barrier compatibility + data = Bukkit.createBlockData(Material.BARRIER); + } else if (parseResult.hasTag("lightbm")) { // light compatibility + data = Bukkit.createBlockData(Material.LIGHT); } if ((parseResult.mark & 1) != 0) { @@ -100,7 +116,7 @@ public void play(@Nullable Player[] ps, Location l, @Nullable Entity e, int coun } // Some particles use offset as RGB color codes - if (type.isColorable() && (!HAS_REDSTONE_DATA || particle != (VisualEffects.OLD_REDSTONE_PARTICLE != null ? VisualEffects.OLD_REDSTONE_PARTICLE : Particle.DUST)) && data instanceof ParticleOption) { + if (type.isColorable() && data instanceof ParticleOption) { ParticleOption option = ((ParticleOption) data); dX = option.getRed(); dY = option.getGreen(); diff --git a/src/main/java/ch/njol/skript/util/visual/VisualEffects.java b/src/main/java/ch/njol/skript/util/visual/VisualEffects.java index 60014886646..dd9d31456c9 100644 --- a/src/main/java/ch/njol/skript/util/visual/VisualEffects.java +++ b/src/main/java/ch/njol/skript/util/visual/VisualEffects.java @@ -19,8 +19,8 @@ package ch.njol.skript.util.visual; import ch.njol.skript.Skript; -import ch.njol.skript.aliases.Aliases; import ch.njol.skript.aliases.ItemType; +import ch.njol.skript.bukkitutil.ItemUtils; import ch.njol.skript.lang.SkriptParser; import ch.njol.skript.lang.SyntaxElementInfo; import ch.njol.skript.localization.Language; @@ -29,13 +29,14 @@ import ch.njol.skript.util.ColorRGB; import ch.njol.skript.util.Direction; import ch.njol.skript.util.SkriptColor; +import ch.njol.skript.util.Timespan; import ch.njol.skript.variables.Variables; import ch.njol.util.StringUtils; import ch.njol.util.coll.iterator.SingleItemIterator; import org.bukkit.*; import org.bukkit.block.BlockFace; +import org.bukkit.entity.Entity; import org.bukkit.inventory.ItemStack; -import org.bukkit.material.MaterialData; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.eclipse.jdt.annotation.Nullable; @@ -53,7 +54,6 @@ public class VisualEffects { private static final boolean NEW_EFFECT_DATA = Skript.classExists("org.bukkit.block.data.BlockData"); - private static final boolean HAS_REDSTONE_DATA = Skript.classExists("org.bukkit.Particle$DustOptions"); private static final Map> effectTypeModifiers = new HashMap<>(); private static SyntaxElementInfo elementInfo; @@ -120,37 +120,15 @@ private static void registerDataSupplier(String id, BiFunction { if (visualEffectTypes != null) // Already registered return; - // Colorables - registerColorable("Particle.SPELL_MOB"); - registerColorable("Particle.SPELL_MOB_AMBIENT"); - registerColorable("Particle.REDSTONE"); - registerColorable("Particle.NOTE"); // Data suppliers registerDataSupplier("Effect.POTION_BREAK", (raw, location) -> @@ -161,72 +139,132 @@ private static void registerDataSupplier(String id, BiFunction { - Color color = raw == null ? defaultColor : (Color) raw; - return new ParticleOption(color, 1); + // Useful: https://minecraft.wiki/w/Particle_format + + /* + * Particles with BlockData DataType + */ + final BiFunction blockDataSupplier = (raw, location) -> { + if (raw instanceof Object[]) { // workaround for modern pattern since it contains a choice + Object[] data = (Object[]) raw; + raw = data[0] != null ? data[0] : data[1]; + } + if (raw == null) + return Bukkit.createBlockData(Material.AIR); + if (raw instanceof ItemType) + return Bukkit.createBlockData(((ItemType) raw).getRandom().getType()); + return raw; + }; + registerDataSupplier("Particle.BLOCK", blockDataSupplier); + registerDataSupplier("Particle.BLOCK_CRACK", blockDataSupplier); + registerDataSupplier("Particle.BLOCK_DUST", blockDataSupplier); + + registerDataSupplier("Particle.BLOCK_MARKER", blockDataSupplier); + + registerDataSupplier("Particle.DUST_PILLAR", blockDataSupplier); + + registerDataSupplier("Particle.FALLING_DUST", blockDataSupplier); + + /* + * Particles with DustOptions DataType + */ + final Color defaultColor = SkriptColor.LIGHT_RED; + final BiFunction dustOptionsSupplier = (raw, location) -> { + Object[] data = (Object[]) raw; + Color color = data[0] != null ? (Color) data[0] : defaultColor; + float size = data[1] != null ? (Float) data[1] : 1; + return new Particle.DustOptions(color.asBukkitColor(), size); + }; + registerDataSupplier("Particle.DUST", dustOptionsSupplier); + registerDataSupplier("Particle.REDSTONE", dustOptionsSupplier); + + /* + * Particles with Color DataType + */ + registerDataSupplier("Particle.ENTITY_EFFECT", (raw, location) -> { + if (raw == null) + return defaultColor.asBukkitColor(); + return ((Color) raw).asBukkitColor(); }); - registerDataSupplier("Particle.SPELL_MOB_AMBIENT", (raw, location) -> { - Color color = raw == null ? defaultColor : (Color) raw; + final BiFunction oldColorSupplier = (raw, location) -> { + Color color = raw != null ? (Color) raw : defaultColor; return new ParticleOption(color, 1); + }; + registerColorable("Particle.SPELL_MOB"); + registerDataSupplier("Particle.SPELL_MOB", oldColorSupplier); + registerColorable("Particle.SPELL_MOB_AMBIENT"); + registerDataSupplier("Particle.SPELL_MOB_AMBIENT", oldColorSupplier); + + final BiFunction itemStackSupplier = (raw, location) -> { + ItemStack itemStack = null; + if (raw instanceof ItemType) + itemStack = ((ItemType) raw).getRandom(); + if (itemStack == null || ItemUtils.isAir(itemStack.getType())) // item crack air is not allowed + itemStack = new ItemStack(Material.IRON_SWORD); + if (IS_ITEM_CRACK_MATERIAL) + return itemStack.getType(); + return itemStack; + }; + registerDataSupplier("Particle.ITEM", itemStackSupplier); + registerDataSupplier("Particle.ITEM_CRACK", itemStackSupplier); + + /* + * Particles with other DataTypes + */ + registerDataSupplier("Particle.DUST_COLOR_TRANSITION", (raw, location) -> { + Object[] data = (Object[]) raw; + Color fromColor = data[0] != null ? (Color) data[0] : defaultColor; + Color toColor = data[1] != null ? (Color) data[1] : defaultColor; + float size = data[2] != null ? (Float) data[2] : 1; + return new Particle.DustTransition(fromColor.asBukkitColor(), toColor.asBukkitColor(), size); }); - registerDataSupplier("Particle.REDSTONE", (raw, location) -> { - Color color = raw == null ? defaultColor : (Color) raw; - ParticleOption particleOption = new ParticleOption(color, 1); - - if (HAS_REDSTONE_DATA && (OLD_REDSTONE_PARTICLE == null || OLD_REDSTONE_PARTICLE.getDataType() == Particle.DustOptions.class)) { - return new Particle.DustOptions(particleOption.getBukkitColor(), particleOption.size); - } else { - return particleOption; - } - }); + + // uses color differently + registerColorable("Particle.NOTE"); + // TODO test how this works registerDataSupplier("Particle.NOTE", (raw, location) -> { int colorValue = (int) (((Number) raw).floatValue() * 255); ColorRGB color = new ColorRGB(colorValue, 0, 0); return new ParticleOption(color, 1); }); - registerDataSupplier("Particle.ITEM_CRACK", (raw, location) -> { - ItemStack itemStack = Aliases.javaItemType("iron sword").getRandom(); - if (raw instanceof ItemType) { - ItemStack rand = ((ItemType) raw).getRandom(); - if (rand != null) - itemStack = rand; - } else if (raw != null) { - return raw; - } - assert itemStack != null; - if (OLD_ITEM_CRACK_PARTICLE == null || OLD_ITEM_CRACK_PARTICLE.getDataType() == Material.class) - return itemStack.getType(); - return itemStack; + // Float DataType, represents "the angle the particle displays at in radians" + registerDataSupplier("Particle.SCULK_CHARGE", (raw, location) -> raw != null ? raw : 0); + + // Integer DataType, represents "the delay in ticks" + registerDataSupplier("Particle.SHRIEK", (raw, location) -> { + int delay = 0; + if (raw instanceof Timespan) + delay = (int) Math.min(Math.max(((Timespan) raw).getTicks(), 0), Integer.MAX_VALUE); + return delay; }); - BiFunction crackDustBiFunction = (raw, location) -> { - if (raw == null) { - return Material.STONE.getData(); - } else if (raw instanceof ItemType) { - ItemStack rand = ((ItemType) raw).getRandom(); - if (NEW_EFFECT_DATA) { - return Bukkit.createBlockData(rand != null ? rand.getType() : Material.STONE); - } else { - if (rand == null) - return Material.STONE.getData(); - - @SuppressWarnings("deprecation") - MaterialData type = rand.getData(); - assert type != null; - return type; - } - } else { - return raw; - } - }; - registerDataSupplier("Particle.BLOCK_CRACK", crackDustBiFunction); - registerDataSupplier("Particle.BLOCK_DUST", crackDustBiFunction); - registerDataSupplier("Particle.FALLING_DUST", crackDustBiFunction); + registerDataSupplier("Particle.VIBRATION", (raw, location) -> VibrationUtils.buildVibration((Object[]) raw, location)); generateTypes(); }); } + // exists to avoid NoClassDefFoundError from Vibration + private static final class VibrationUtils { + private static Vibration buildVibration(Object[] data, Location location) { + int arrivalTime = -1; + if (data[1] != null) + arrivalTime = (int) Math.min(Math.max(((Timespan) data[1]).getTicks(), 0), Integer.MAX_VALUE); + if (data[0] instanceof Entity) { + Entity entity = (Entity) data[0]; + if (arrivalTime == -1) + arrivalTime = (int) (location.distance(entity.getLocation()) / 20); + //noinspection removal - new constructor only exists on newer versions + return new Vibration(location, new Vibration.Destination.EntityDestination(entity), arrivalTime); + } + // assume it's a location + Location destination = data[0] != null ? (Location) data[0] : location; + if (arrivalTime == -1) + arrivalTime = (int) (location.distance(destination) / 20); + //noinspection removal - new constructor only exists on newer versions + return new Vibration(location, new Vibration.Destination.BlockDestination(destination), arrivalTime); + } + } + } diff --git a/src/main/resources/lang/default.lang b/src/main/resources/lang/default.lang index 21bfe5f6092..9f7df2c9e4c 100644 --- a/src/main/resources/lang/default.lang +++ b/src/main/resources/lang/default.lang @@ -1397,15 +1397,6 @@ visual effects: iron_golem_rose: name: iron golem offering rose @an pattern: (iron golem [offering] rose|rose in hand) - villager_heart: - name: villager hearts @x - pattern: villager hearts - villager_angry: - name: angry villager entity @an - pattern: angry villager entity - villager_happy: - name: happy villager entity @a - pattern: happy villager entity witch_magic: name: witch magic @- pattern: witch magic @@ -1458,324 +1449,550 @@ visual effects: name: hurt by explosion @- pattern: (hurt|damage) by explosion particle: - fireworks_spark: - name: firework's spark @- - pattern: firework['s] spark - crit: - name: critical hit @a - pattern: (critical hit|crit) [spark] - crit_magic: - name: magical critical hit @a - pattern: (magic[al]|blue) (critical hit|crit) [spark] - spell_mob: - name: potion swirl @a - pattern: [%-color%] potion swirl - spell_mob_ambient: - name: transparent potion swirl @a - pattern: [%-color%] transparent potion swirl - spell: - name: spell @a - pattern: (spell|thrown potion|lingering potion) - spell_instant: - name: spell @a - pattern: instant (spell|thrown potion) - spell_witch: - name: witch spell @- - pattern: (witch (magic|spell)|purple spark) - note: - name: note @a - pattern: note [(of|with) [colo[u]r] %number%] - portal: - name: portal @a - pattern: [nether] portal - enchantment_table: - name: flying glyph @a - pattern: (flying (glyph|letter)|enchantment table) - flame: - name: flame @- - pattern: (flame|fire) - lava: - name: lava pop @a - pattern: lava pop - footstep: - name: footstep @x - pattern: footsteps - water_splash: - name: water splash @a - pattern: [water] splash - smoke_normal: - name: smoke particle @a - pattern: smoke particle - explosion_huge: - name: huge explosion @a - pattern: huge explosion - explosion_large: - name: large explosion @a - pattern: large explosion - explosion_normal: - name: explosion @an - pattern: explosion - suspended_depth: - name: void fog @- - pattern: void fog - town_aura: - name: small smoke @- - pattern: (small smoke|town aura) - cloud: - name: cloud @a - pattern: cloud - redstone: - name: coloured dust @- - pattern: [%-color%] [colo[u]red] dust - snowball: - name: snowball break @a - pattern: snowball break - drip_water: - name: water drip @a - pattern: water drip - drip_lava: - name: lava drip @a - pattern: lava drip - snow_shovel: - name: snow shovel @- - pattern: (snow shovel|snow(man| golem) spawn) - slime: - name: slime @- - pattern: slime - heart: - name: heart @a - pattern: heart - villager_angry: + + angry_villager: # added in 1.20.5 name: angry villager @a pattern: (angry villager|[villager] thundercloud) - villager_happy: - name: happy villager @- - pattern: (happy villager|green spark) - smoke_large: - name: large smoke @- - pattern: large smoke - item_crack: - name: item crack @- - pattern: %itemtype% item (break|crack)[ing] - block_crack: + villager_angry: # for versions below 1.20.5 + name: angry villager @a + pattern: (angry villager|[villager] thundercloud) + + ash: # added in 1.16 + name: ash @- + pattern: ash + + block: # added in 1.20.5 + name: block @- + pattern: (%-blockdata/itemtype% break[ing]|[sprinting] dust of %-blockdata/itemtype%) + block_crack: # for versions below 1.20.5 name: block break @- - pattern: %itemtype% break[ing] - block_dust: + pattern: %blockdata/itemtype% break[ing] + block_dust: # for versions below 1.20.5 name: block dust @- - pattern: [sprinting] dust of [%itemtype%] - end_rod: - name: end rod @- - pattern: end rod - falling_dust: - name: falling dust @- - pattern: falling dust of [%itemtype%] + pattern: [sprinting] dust of %blockdata/itemtype% - # 1.11 particles - totem: - name: totem @- - pattern: totem - spit: - name: spit @- - pattern: spit + block_marker: # added in 1.18 + name: block marker @a + pattern: (barrierbm:barrier|lightbm:light|%-blockdata/itemtype% block marker) + barrier: + name: barrier @a + pattern: barrier + light: # added in 1.17 + name: light @- + pattern: light - # 1.13 particles - squid_ink: - name: squid ink @- - pattern: squid ink - bubble_pop: - name: bubble pop @- - pattern: bubble pop - current_down: - name: current down @- - pattern: (current|bubble column) down - bubble_column_up: + bubble: # added in 1.20.5 + name: bubble @- + pattern: [water] bubble + water_bubble: # for versions below 1.20.5 + name: water bubble @- + pattern: [water] bubble + + bubble_column_up: # added in 1.13 name: bubble column up @- pattern: (current|bubble column) up - nautilus: - name: nautilus @- - pattern: nautilus - dolphin: - name: dolphin @- - pattern: dolphin - # 1.14 particles - sneeze: - name: sneeze @- - pattern: sneeze - campfire_cosy_smoke: + bubble_pop: # added in 1.13 + name: bubble pop @- + pattern: bubble pop + + campfire_cosy_smoke: # added in 1.14 name: campfire cosy smoke @- pattern: campfire co(s|z)y smoke - campfire_signal_smoke: + + campfire_signal_smoke: # added in 1.14 name: campfire signal smoke @- pattern: campfire signal smoke - composter: + + cherry_leaves: # added in 1.20 + name: cherry leaves @- + pattern: cherry leaves + + cloud: + name: cloud @a + pattern: cloud + + composter: # added in 1.14 name: composter @- - pattern: composter particle - flash: - name: flash @- - pattern: flash - falling_lava: - name: falling lava @- - pattern: falling lava - landing_lava: - name: landing lava @- - pattern: landing lava - falling_water: - name: falling water @- - pattern: falling water - barrier: - name: barrier @a - pattern: barrier - damage_indicator: + pattern: composter [particle] + + crimson_spore: # added in 1.16 + name: crimson spore @- + pattern: crimson spore + + crit: + name: critical hit @a + pattern: (critical hit|crit) [spark] + + current_down: # added in 1.13 + name: current down @- + pattern: (current|bubble column) down + + damage_indicator: # added in 1.14 name: damage indicator @- pattern: damage indicator - dragon_breath: + + dolphin: # added in 1.13 + name: dolphin @- + pattern: dolphin + + dragon_breath: # added in 1.14 name: dragon breath @- - pattern: dragon[s] breath - mob_appearance: - name: mob appearance @- - pattern: (mob appearance|guardian ghost) - suspended: - name: suspended @- - pattern: (suspended|underwater) - sweep_attack: - name: sweep attack @- - pattern: sweep attack - water_bubble: - name: water bubble @- - pattern: water bubble - water_wake: - name: water wake @- - pattern: water wake - water_drop: - name: water drop @- - pattern: water drop + pattern: dragon[[']s] breath + + dripping_dripstone_lava: # added in 1.17 + name: dripping dripstone lava @- + pattern: dripping dripstone lava + + dripping_dripstone_water: # added in 1.17 + name: dripping dripstone water @- + pattern: dripping dripstone water - # 1.15 particles - dripping_honey: + dripping_honey: # added in 1.15 name: dripping honey @- pattern: dripping honey - falling_honey: + + dripping_lava: # added in 1.20.5 + name: dripping lava @a + pattern: (dripping lava|lava drip) + drip_lava: # for versions below 1.20.5 + name: lava drip @a + pattern: (dripping lava|lava drip) + + dripping_obsidian_tear: # added in 1.16 + name: dripping obsidian tear @- + pattern: dripping obsidian tear + + dripping_water: # added in 1.20.5 + name: dripping water + pattern: (dripping water|water drip) + drip_water: # for versions below 1.20.5 + name: water drip @a + pattern: (dripping water|water drip) + + dust: # added in 1.20.5 + name: dust @- + pattern: [%-color%] [colo[u]red] dust [with size %-float%] + redstone: # for versions below 1.20.5 + name: coloured dust @- + pattern: [%-color%] [colo[u]red] dust [with size %-float%] + + dust_color_transition: # added in 1.17 + name: dust color transition @a + pattern: dust colo[u]r transition [from %-color%] [to %-color%] [with size %-float%] + + dust_pillar: # added in 1.20.5 (for 1.21) + name: dust pillar @a + pattern: %blockdata/itemtype% dust pillar + + dust_plume: # added in 1.20.3 + name: dust plume @a + pattern: dust plume + + effect: # added in 1.20.5 + name: effect @an + pattern: (effect|spell|thrown potion) # lingering is part of entity_effect + spell: # for versions below 1.20.5 + name: spell @a + pattern: (effect|spell|thrown potion|lingering potion) + + egg_crack: # added in 1.20 + name: egg crack @an + pattern: [sniffer] egg crack + + elder_guardian: # added in 1.20.5 + name: elder guardian @- + pattern: (elder guardian|mob appearance|guardian ghost) + mob_appearance: # for versions below 1.20.5 + name: mob appearance @- + pattern: (elder guardian|mob appearance|guardian ghost) + + electric_spark: + name: electric spark @- + pattern: electric spark + + enchant: # added in 1.20.5 + name: enchant + pattern: (enchant|flying (glyph|letter)|enchantment table) + enchantment_table: # for versions below 1.20.5 + name: flying glyph @a + pattern: (enchant|flying (glyph|letter)|enchantment table) + + enchanted_hit: # added in 1.20.5 + name: enchanted hit @an + pattern: (enchanted hit|(magic[al]|blue) (critical hit|crit) [spark]) + crit_magic: # for versions below 1.20.5 + name: magical critical hit @a + pattern: (enchanted hit|(magic[al]|blue) (critical hit|crit) [spark]) + + end_rod: + name: end rod @- + pattern: end rod + + entity_effect: # added in 1.20.5 + name: entity effect @an + pattern: (lingering potion|[%-color%] [transparent] potion swirl) + # TODO ambient_entity_effect seems to exist, but is not supported by spigot particle enum? + spell_mob: # for versions below 1.20.5 + name: potion swirl @a + pattern: [%-color%] potion swirl + spell_mob_ambient: # for versions below 1.20.5 + name: transparent potion swirl @a + pattern: [%-color%] transparent potion swirl + + # TODO explosions are a mess (see explosion_normal, explosion_large, explosion_huge) + explosion: # added in 1.20.5 + name: large explosion @a + pattern: large explosion + explosion_large: # for versions below 1.20.5 + name: large explosion @a + pattern: large explosion + + explosion_emitter: # added in 1.20.5 + name: explosion emitter @an + pattern: (explosion emitter|huge explosion) + explosion_huge: # for versions below 1.20.5 + name: huge explosion @a + pattern: (explosion emitter|huge explosion) + + falling_dripstone_lava: # added in 1.17 + name: falling dripstone lava @- + pattern: falling dripstone lava + + falling_dripstone_water: # added in 1.17 + name: falling dripstone water @- + pattern: falling dripstone water + + falling_dust: + name: falling dust @- + pattern: falling dust of %blockdata/itemtype% + + falling_honey: # added in 1.15 name: falling honey @- pattern: falling honey - landing_honey: - name: landing honey @- - pattern: landing honey - falling_nectar: + + falling_lava: # added in 1.14 + name: falling lava @- + pattern: falling lava + + falling_nectar: # added in 1.15 name: falling nectar @- pattern: falling nectar - # 1.16 particles - ash: - name: ash @- - pattern: ash - crimson_spore: - name: crimson spore @- - pattern: crimson spore - soul_fire_flame: - name: soul fire flame @- - pattern: soul fire flame - warped_spore: - name: warped spore @- - pattern: warped spore - dripping_obsidian_tear: - name: dripping obsidian tear @- - pattern: dripping obsidian tear - falling_obsidian_tear: + falling_obsidian_tear: # added in 1.16 name: falling obsidian tear @- pattern: falling obsidian tear - landing_obsidian_tear: - name: landing obsidian tear @- - pattern: landing obsidian tear - soul: - name: soul @- - pattern: soul - reverse_portal: - name: reverse portal @- - pattern: reverse portal - white_ash: - name: white ash @- - pattern: white ash - # 1.17 particles - light: - name: light @- - pattern: light - #dust_color_transition: - #name: dust color transition @a - #pattern: dust colo[u]r transition [from %-color%] [to %-color%] [with size %-number%] - #vibration: - #name: vibration @a - #pattern: vibration - falling_spore_blossom: + + falling_spore_blossom: # added in 1.17 name: falling spore blossom @- pattern: falling spore blossom - spore_blossom_air: - name: spore blossom air @- - pattern: spore blossom air - small_flame: - name: small flame @- - pattern: small flame - snowflake: - name: snowflake @- - pattern: snowflake - dripping_dripstone_lava: - name: dripping dripstone lava @- - pattern: dripping dripstone lava - falling_dripstone_lava: - name: falling dripstone lava @- - pattern: falling dripstone lava - dripping_dripstone_water: - name: dripping dripstone water @- - pattern: dripping dripstone water - falling_dripstone_water: - name: falling dripstone water @- - pattern: falling dripstone water - glow_squid_ink: - name: glow squid ink @- - pattern: glow squid ink - glow: + + falling_water: # added in 1.14 + name: falling water @- + pattern: falling water + + firework: # added in 1.20.5 + name: firework @- + pattern: (firework|firework['s] spark) + fireworks_spark: # for versions below 1.20.5 + name: firework's spark @- + pattern: (firework|firework['s] spark) + + fishing: # added in 1.20.5 + name: water wake @- + pattern: (fishing|water wake) + water_wake: # for versions below 1.20.5 + name: water wake @- + pattern: (fishing|water wake) + + flame: + name: flame @- + pattern: (flame|fire) + + flash: # added in 1.14 + name: flash @- + pattern: flash + + glow: # added in 1.17 name: glow @- pattern: glow - wax_on: - name: wax on @- - pattern: wax on - wax_off: - name: wax off @- - pattern: wax off - electric_spark: - name: electric spark @- - pattern: electric spark - scrape: + + glow_squid_ink: # added in 1.17 + name: glow squid ink @- + pattern: glow squid ink + + gust: # added in 1.20.5 (for 1.21) + name: gust @a + pattern: gust + + gust_emitter_large: # added in 1.20.5 (for 1.21) + name: large gust emitter @a + pattern: large gust emitter + + gust_emitter_small: # added in 1.20.5 (for 1.21) + name: small gust emitter @a + pattern: small gust emitter + + happy_villager: # added in 1.20.5 + name: happy villager @- + pattern: (happy villager|green spark) + villager_happy: + name: happy villager @- + pattern: (happy villager|green spark) + + heart: + name: heart @a + pattern: heart + + infested: # added in 1.20.5 (for 1.21) + name: infested @- + pattern: infested + + instant_effect: # added in 1.20.5 + name: instant effect @an + pattern: instant (effect|spell|thrown potion) + spell_instant: # for versions below 1.20.5 + name: spell @a + pattern: instant (effect|spell|thrown potion) + + item: # added in 1.20.5 + name: item @- + pattern: %itemtype% item (break|crack)[ing] + item_crack: # for versions below 1.20.5 + name: item crack @- + pattern: %itemtype% item (break|crack)[ing] + + item_cobweb: # added in 1.20.5 (for 1.21) + name: cobweb @- + pattern: cobweb + + item_slime: # added in 1.20.5 + name: slime @- + pattern: slime + slime: # for versions below 1.20.5 + name: slime @- + pattern: slime + + item_snowball: # added in 1.20.5 + name: snowball @- + pattern: (snowball [break]|snow shovel|snow(man| golem) spawn) + snowball: # for versions below 1.20.5 + name: snowball break @- + pattern: snowball break + snow_shovel: # for versions below 1.20.5 + name: snow shovel @- + pattern: (snowball|snow shovel|snow(man| golem) spawn) + + landing_honey: # added in 1.15 + name: landing honey @- + pattern: landing honey + + landing_lava: # added in 1.14 + name: landing lava @- + pattern: landing lava + + landing_obsidian_tear: # added in 1.16 + name: landing obsidian tear @- + pattern: landing obsidian tear + + large_smoke: # added in 1.20.5 + name: large smoke @- + pattern: large smoke + smoke_large: # for versions below 1.20.5 + name: large smoke @- + pattern: large smoke + + lava: + name: lava pop @a + pattern: lava pop + + mycelium: # previously town_aura, changed in 1.20.5 + name: mycelium @- + pattern: (mycelium|small smoke|town aura) + town_aura: + name: small smoke @- + pattern: (mycelium|small smoke|town aura) + + nautilus: # added in 1.13 + name: nautilus @- + pattern: nautilus + + note: + name: note @a + pattern: note [(of|with) [colo[u]r] %number%] + + ominous_spawning: # added in 1.20.5 (for 1.21) + name: ominous spawning @- + pattern: ominous spawning + + poof: # added in 1.20.5 + name: poof @a + pattern: (poof|explosion) + explosion_normal: # for versions below 1.20.5 + name: explosion @an + pattern: (poof|explosion) + + portal: + name: portal @a + pattern: [nether] portal + + raid_omen: # added in 1.20.5 (1.21) + name: raid omen @a + pattern: raid omen + + rain: # added in 1.20.5 + name: rain @- + pattern: (rain|water drop) + water_drop: # for versions below 1.20.5 + name: water drop @a + pattern: (rain|water drop) + + reverse_portal: # added in 1.16 + name: reverse portal @- + pattern: reverse portal + + scrape: # added in 1.17 name: scrape @- pattern: scrape - # 1.19 particles - sonic_boom: - name: sonic boom @- - pattern: sonic boom - sculk_soul: - name: sculk soul @- - pattern: sculk soul - sculk_charge: + sculk_charge: # added in 1.19 name: sculk charge @- - pattern: sculk charge - sculk_charge_pop: + pattern: sculk charge [with ([a] roll|[an] angle) [of] %-float%] + + sculk_charge_pop: # added in 1.19 name: sculk charge pop @- pattern: sculk charge pop - shriek: + + sculk_soul: # added in 1.19 + name: sculk soul @- + pattern: sculk soul + + shriek: # added in 1.19 name: shriek @- - pattern: shriek - - # 1.19.4 particles - dripping_cherry_leaves: - name: dripping cherry leaves @- - pattern: dripping cherry leaves - falling_cherry_leaves: - name: falling cherry leaves @- - pattern: falling cherry leaves - landing_cherry_leaves: - name: landing cherry leaves @- - pattern: landing cherry leaves + pattern: shriek [with [a] delay [of] %-timespan%] + + small_flame: # added in 1.17 + name: small flame @a + pattern: small flame + + small_gust: # added in 1.20.5 (for 1.21) + name: small gust @a + pattern: small gust + + smoke: # added in 1.20.5 + name: smoke @- + pattern: smoke [particle] + smoke_normal: # for versions below 1.20.5 + name: smoke @- + pattern: smoke [particle] + + sneeze: # added in 1.14 + name: sneeze @a + pattern: sneeze + + snowflake: # added in 1.17 + name: snowflake @a + pattern: snowflake + + sonic_boom: # added in 1.19 + name: sonic boom @a + pattern: sonic boom + + soul: # added in 1.16 + name: soul @- + pattern: soul + + soul_fire_flame: # added in 1.16 + name: soul fire flame @a + pattern: soul fire flame + + spit: # added in 1.11 + name: spit @- + pattern: spit + + splash: # added in 1.20.5 + name: splash @a + pattern: [water] splash + water_splash: # for versions below 1.20.5 + name: water splash @a + pattern: [water] splash + + spore_blossom_air: # added in 1.17 + name: spore blossom air @- + pattern: spore blossom air + + squid_ink: # added in 1.13 + name: squid ink @- + pattern: squid ink + + sweep_attack: # added in 1.14 + name: sweep attack @a + pattern: sweep attack + + totem_of_undying: # added in 1.20.5 + name: totem of undying @a + pattern: totem [of undying] + totem: # for versions below 1.20.5 + name: totem @a + pattern: totem [of undying] + + trial omen: # added in 1.20.5 (for 1.21) + name: trial omen @a + pattern: trial omen + + trial_spawner_detection: # added in 1.20.5 (for 1.21) + name: trial spawner detection @- + pattern: trial spawner detection + + trial_spawner_detection_ominous: # added in 1.20.5 (for 1.21) + name: ominous trial spawner detection @- + pattern: ominous trial spawner detection + + underwater: # added in 1.20.5 + name: underwater @- + pattern: (underwater|suspended|void fog) + suspended: # for versions below 1.20.5 + name: suspended @- + pattern: (underwater|suspended) + suspended_depth: # for versions below 1.20.5 + name: void fog @- + pattern: void fog + + vault_connection: # added in 1.20.5 (for 1.21) + name: vault connection @- + pattern: vault connection + + vibration: # added in 1.17 + name: vibration @a + # must be a literal, so you can't actually use this properly yet + pattern: vibration [to %-entity/location%] [over %-timespan%] + + warped_spore: # added in 1.16 + name: warped spore @a + pattern: warped spore + + wax_off: # added in 1.17 + name: wax off @- + pattern: wax off + + wax_on: # added in 1.17 + name: wax on @- + pattern: wax on + + white_ash: # added in 1.16 + name: white ash @- + pattern: white ash + + white_smoke: # added in 1.20.3 + name: white smoke @- + pattern: white smoke + + witch: # added in 1.20.5 + name: witch @a + pattern: (witch [magic|spell]|purple spark) + spell_witch: # for versions below 1.20.5 + name: witch spell @a + pattern: (witch [magic|spell]|purple spark) # -- Inventory Actions -- inventory actions: diff --git a/src/test/skript/tests/regressions/3284-itemcrack particle.sk b/src/test/skript/tests/regressions/3284-itemcrack particle.sk index 0390fb158bd..470e61948c4 100644 --- a/src/test/skript/tests/regressions/3284-itemcrack particle.sk +++ b/src/test/skript/tests/regressions/3284-itemcrack particle.sk @@ -1,3 +1,3 @@ -test "item crack particles" when running below minecraft "1.20.5": # item crack does not exist on 1.20.5 +test "item crack particles": set {_loc} to location of spawn of world "world" play diamond sword item crack at {_loc} diff --git a/src/test/skript/tests/syntaxes/effects/EffVisualEffect.sk b/src/test/skript/tests/syntaxes/effects/EffVisualEffect.sk new file mode 100644 index 00000000000..b8631e79cf2 --- /dev/null +++ b/src/test/skript/tests/syntaxes/effects/EffVisualEffect.sk @@ -0,0 +1,112 @@ +# we want to ensure particles parse and play on all versions +test "visual effects": + set {_} to location of spawn of world "world" + play angry villager at {_} + play air breaking at {_} + play sprinting dust of air at {_} + play barrier at {_} + play bubble at {_} + play bubble column up at {_} + play bubble pop at {_} + play cloud at {_} + play crit at {_} + play current down at {_} + play dolphin at {_} + play dripping lava at {_} + play dripping water at {_} + play white dust with size 2 at {_} + play effect at {_} + play elder guardian at {_} + play enchant at {_} + play enchanted hit at {_} + play end rod at {_} + play lingering potion at {_} + play white potion swirl at {_} + play white transparent potion swirl at {_} + play large explosion at {_} + play explosion emitter at {_} + play falling dust of air at {_} + play firework at {_} + play fishing at {_} + play flame at {_} + play happy villager at {_} + play instant effect at {_} + play iron sword item break at {_} + play slime at {_} + play snowball at {_} + play snowball break at {_} + play large smoke at {_} + play lava pop at {_} + play mycelium at {_} + play nautilus at {_} + play note at {_} + play note of 5 at {_} + play poof at {_} + play portal at {_} + play rain at {_} + play smoke at {_} + play spit at {_} + play splash at {_} + play squid ink at {_} + play totem of undying at {_} + play suspended at {_} + play void fog at {_} + play witch at {_} + parse if running minecraft "1.14.4": + play campfire cosy smoke at {_} + play campfire signal smoke at {_} + play composter at {_} + play damage indicator at {_} + play dragon's breath at {_} + play falling lava at {_} + play falling water at {_} + play flash at {_} + play landing lava at {_} + play sneeze at {_} + play sweep attack at {_} + parse if running minecraft "1.15.2": + play dripping honey at {_} + play falling honey at {_} + play falling nectar at {_} + play landing honey at {_} + parse if running minecraft "1.16.5": + play ash at {_} + play crimson spore at {_} + play dripping obsidian tear at {_} + play falling obsidian tear at {_} + play landing obsidian tear at {_} + play reverse portal at {_} + play soul at {_} + play soul fire flame at {_} + play warped spore at {_} + play white ash at {_} + parse if running minecraft "1.17.1": + play light at {_} + play dripping dripstone lava at {_} + play dripping dripstone water at {_} + play dust color transition from white to white with size 1 at {_} + play falling dripstone lava at {_} + play falling dripstone water at {_} + play falling spore blossom at {_} + play glow at {_} + play glow squid ink at {_} + play scrape at {_} + play small flame at {_} + play snowflake at {_} + play spore blossom air at {_} + play vibration over 1 second at {_} + play wax off at {_} + play wax on at {_} + parse if running minecraft "1.18.2": + play air block marker at {_} + parse if running minecraft "1.19.4": + play sculk charge with a roll of 1 at {_} + play sculk charge pop at {_} + play sculk soul at {_} + play shriek with a delay of 0 seconds at {_} + play sonic boom at {_} + parse if running minecraft "1.20.6": + play cherry leaves at {_} + play dust plume at {_} + play egg crack at {_} + play white smoke at {_}