diff --git a/ParticleHats/src/com/mediusecho/particlehats/particles/ParticleEffect.java b/ParticleHats/src/com/mediusecho/particlehats/particles/ParticleEffect.java index 82c9fb2..394c226 100644 --- a/ParticleHats/src/com/mediusecho/particlehats/particles/ParticleEffect.java +++ b/ParticleHats/src/com/mediusecho/particlehats/particles/ParticleEffect.java @@ -10,115 +10,125 @@ import org.bukkit.inventory.ItemStack; import java.util.HashMap; import java.util.Map; +import java.util.function.Predicate; public enum ParticleEffect { - NONE (0, 0, -1, CompatibleMaterial.SCUTE), - BARRIER (1, 35, 8, "barrier", CompatibleMaterial.BARRIER), - BLOCK_CRACK (2, 37, -1, "blockcrack", Material.DIAMOND_PICKAXE, ParticleProperty.BLOCK_DATA), - BLOCK_DUST (3, 38, 7, "blockdust", CompatibleMaterial.GUNPOWDER, ParticleProperty.BLOCK_DATA), - BUBBLE_COLUMN_UP (4, -1, 13, CompatibleMaterial.HORN_CORAL), - BUBBLE_POP (5, -1, 13, CompatibleMaterial.PURPLE_DYE), - CLOUD (6, 29, -1, "cloud", CompatibleMaterial.BONE_MEAL), - CRIT (7, 9, -1, "crit", Material.DIAMOND_CHESTPLATE), - CRIT_MAGIC (8, 10, -1, "magicCrit", Material.DIAMOND_SWORD), - CURRENT_DOWN (9, -1, 13, CompatibleMaterial.LAPIS_LAZULI), - DAMAGE_INDICATOR (10, 44, 9, "damageIndicator", Material.IRON_SWORD), - DRAGON_BREATH (11, 42, 9, "dragonbreath", CompatibleMaterial.DRAGON_HEAD), - DRIP_LAVA (12, 19, -1, "dripLava", Material.LAVA_BUCKET), - DRIP_WATER (13, 18, -1, "dripWater", Material.WATER_BUCKET), - DOLPHIN (14, -1, 13, CompatibleMaterial.PRISMARINE_SHARD), - ENCHANTMENT_TABLE (15, 25, -1, "enchantmenttable", CompatibleMaterial.ENCHANTING_TABLE), - END_ROD (16, 43, 9, "endRod", CompatibleMaterial.END_ROD), - EXPLOSION_HUGE (17, 2, -1, "hugeexplosion", Material.TNT), - EXPLOSION_LARGE (18, 1, -1, "largeexplode", Material.TNT), - EXPLOSION_NORMAL (19, 0, -1, "explode", Material.TNT), - FALLING_DUST (20, 46, 10, "fallingdust", Material.SAND, ParticleProperty.BLOCK_DATA), - FIREWORKS_SPARK (21, 3, -1, "fireworksSpark", CompatibleMaterial.FIREWORK_ROCKET), - FLAME (22, 26, -1, "flame", Material.TORCH), - HEART (23, 34, -1, "heart", Material.REDSTONE_BLOCK), - ITEM_CRACK (24, 36, -1, "iconcrack", Material.APPLE, ParticleProperty.ITEM_DATA), - LAVA (25, 27, -1, "lava", CompatibleMaterial.MAGMA_BLOCK), - MOB_APPEARANCE (26, 41, 8, "mobappearance", CompatibleMaterial.PLAYER_HEAD), - NAUTILUS (27, -1, 13, CompatibleMaterial.CONDUIT), - NOTE (28, 23, -1, "note", Material.NOTE_BLOCK), - PORTAL (29, 24, -1, "portal", Material.SOUL_SAND), - REDSTONE (30, 30, -1, "reddust", Material.REDSTONE, ParticleProperty.COLOR), - SLIME (31, 33, -1, "slime", Material.SLIME_BALL), - SMOKE_LARGE (32, 12, -1, "largesmoke", CompatibleMaterial.BONE_MEAL), - SMOKE_NORMAL (33, 11, -1, "smoke", Material.FLINT_AND_STEEL), - SNOW_SHOVEL (34, 32, -1, Material.SNOW_BLOCK), - SNOWBALL (35, 31, -1, "snowballpoof", CompatibleMaterial.SNOWBALL), - SPELL (36, 13, -1, "spell", Material.POTION), - SPELL_INSTANT (37, 14, -1, "instantSpell", CompatibleMaterial.SPLASH_POTION), - SPELL_MOB (38, 15, -1, "mobSpell", CompatibleMaterial.ZOMBIE_HEAD), - SPELL_MOB_AMBIENT (39, 16, -1, "mobSpellAmbient", Material.POTION), - SPELL_WITCH (40, 17, -1, "witchMagic", CompatibleMaterial.SPLASH_POTION), - SPIT (41, 48, 11, "spit", CompatibleMaterial.BONE_MEAL), - SQUID_INK (42, -1, 13, CompatibleMaterial.INK_SAC), - SUSPENDED (43, 7, -1, "suspended", Material.BEDROCK), - SUSPENDED_DEPTH (44, 8, -1, "depthSuspend", Material.BEDROCK), - SWEEP_ATTACK (45, 45, 9, "sweepAttack", Material.DIAMOND_SWORD), - TOTEM (46, 47, 11, "totem", CompatibleMaterial.TOTEM_OF_UNDYING), - TOWN_AURA (47, 22, -1, "townaura", Material.BEACON), - VILLAGER_ANGRY (48, 20, -1, "angryVillager", CompatibleMaterial.WITHER_SKELETON_SKULL), - VILLAGER_HAPPY (49, 21, -1, "happyVillager", CompatibleMaterial.PLAYER_HEAD), - WATER_BUBBLE (50, 4, -1, "bubble", Material.FISHING_ROD), - WATER_DROP (51, 39, 8, Material.WATER_BUCKET), - WATER_SPLASH (52, 5, -1, "splash", CompatibleMaterial.BIRCH_BOAT), - WATER_WAKE (53, 6, 7, "wake", CompatibleMaterial.OAK_BOAT), - ITEMSTACK (54, -1, -1, Material.DIAMOND, ParticleProperty.ITEMSTACK_DATA), - CAMPFIRE_COSY_SMOKE (55, -1, 14, CompatibleMaterial.CAMPFIRE), - CAMPFIRE_SIGNAL_SMOKE (56, -1, 14, CompatibleMaterial.CAMPFIRE), - COMPOSTER (57, -1, 14, CompatibleMaterial.COMPOSTER), - FALLING_LAVA (58, -1, 14, Material.LAVA_BUCKET), - FALLING_WATER (59, -1, 14, Material.WATER_BUCKET), - FLASH (60, -1, 14, CompatibleMaterial.LANTERN), - SNEEZE (61, -1, 14, CompatibleMaterial.GRAY_DYE), - EMPTY_SPACE (62, -1, -1, CompatibleMaterial.BARRIER), - LANDING_LAVA (63, -1, 14, Material.MAGMA_CREAM), - DRIPPING_HONEY (64, -1, 15, CompatibleMaterial.HONEY_BOTTLE), - FALLING_HONEY (65, -1, 15, CompatibleMaterial.HONEYCOMB), - FALLING_NECTAR (66, -1, 15, CompatibleMaterial.DANDELION), - LANDING_HONEY (67, -1, 15, CompatibleMaterial.HONEY_BOTTLE), - SOUL_FIRE_FLAME (68, -1, 16, CompatibleMaterial.SOUL_CAMPFIRE), - ASH (69, -1, 16, CompatibleMaterial.BLACK_DYE), - CRIMSON_SPORE (70, -1, 16, CompatibleMaterial.CRIMSON_FUNGUS), - WARPED_SPORE (71, -1, 16, CompatibleMaterial.WARPED_FUNGUS), - SOUL (72, -1, 16, CompatibleMaterial.SOUL_LANTERN), - DRIPPING_OBSIDIAN_TEAR (73, -1, 16, CompatibleMaterial.CRYING_OBSIDIAN), - FALLING_OBSIDIAN_TEAR (74, -1, 16, CompatibleMaterial.CRYING_OBSIDIAN), - LANDING_OBSIDIAN_TEAR (75, -1, 16, CompatibleMaterial.CRYING_OBSIDIAN), - REVERSE_PORTAL (76, -1, 16, Material.OBSIDIAN), - WHITE_ASH (77, -1, 16, CompatibleMaterial.WHITE_DYE), - LIGHT (78, -1, 17, CompatibleMaterial.LIGHT), + NONE (0, 0, (v) -> true, CompatibleMaterial.SCUTE), + BARRIER (1, 35, (v) -> v >= 8, "barrier", CompatibleMaterial.BARRIER), + BLOCK_CRACK (2, 37, (v) -> true, "blockcrack", Material.DIAMOND_PICKAXE, ParticleProperty.BLOCK_DATA, "block"), + BLOCK_DUST (3, 38, (v) -> v >= 7, "blockdust", CompatibleMaterial.GUNPOWDER, ParticleProperty.BLOCK_DATA), + BUBBLE_COLUMN_UP (4, -1, (v) -> v >= 13, CompatibleMaterial.HORN_CORAL), + BUBBLE_POP (5, -1, (v) -> v >= 13, CompatibleMaterial.PURPLE_DYE), + CLOUD (6, 29, (v) -> true, "cloud", CompatibleMaterial.BONE_MEAL), + CRIT (7, 9, (v) -> true, "crit", Material.DIAMOND_CHESTPLATE), + CRIT_MAGIC (8, 10, (v) -> true, "magicCrit", Material.DIAMOND_SWORD, "enchanted_hit"), + CURRENT_DOWN (9, -1, (v) -> v >= 13, CompatibleMaterial.LAPIS_LAZULI), + DAMAGE_INDICATOR (10, 44, (v) -> v >= 9, "damageIndicator", Material.IRON_SWORD), + DRAGON_BREATH (11, 42, (v) -> v >= 9, "dragonbreath", CompatibleMaterial.DRAGON_HEAD), + DRIP_LAVA (12, 19, (v) -> true, "dripLava", Material.LAVA_BUCKET, "dripping_lava"), + DRIP_WATER (13, 18, (v) -> true, "dripWater", Material.WATER_BUCKET, "dripping_water"), + DOLPHIN (14, -1, (v) -> v >= 13, CompatibleMaterial.PRISMARINE_SHARD), + ENCHANTMENT_TABLE (15, 25, (v) -> true, "enchantmenttable", CompatibleMaterial.ENCHANTING_TABLE, "enchant"), + END_ROD (16, 43, (v) -> v >= 9, "endRod", CompatibleMaterial.END_ROD), + EXPLOSION_HUGE (17, 2, (v) -> true, "hugeexplosion", Material.TNT, "explosion_emitter"), + EXPLOSION_LARGE (18, 1, (v) -> true, "largeexplode", Material.TNT, "explosion"), + EXPLOSION_NORMAL (19, 0, (v) -> true, "explode", Material.TNT, "poof"), + FALLING_DUST (20, 46, (v) -> v >= 10, "fallingdust", Material.SAND, ParticleProperty.BLOCK_DATA), + FIREWORKS_SPARK (21, 3, (v) -> true, "fireworksSpark", CompatibleMaterial.FIREWORK_ROCKET, "firework"), + FLAME (22, 26, (v) -> true, "flame", Material.TORCH), + HEART (23, 34, (v) -> true, "heart", Material.REDSTONE_BLOCK), + ITEM_CRACK (24, 36, (v) -> true, "iconcrack", Material.APPLE, ParticleProperty.ITEM_DATA, "item"), + LAVA (25, 27, (v) -> true, "lava", CompatibleMaterial.MAGMA_BLOCK), + MOB_APPEARANCE (26, 41, (v) -> v >= 8, "mobappearance", CompatibleMaterial.PLAYER_HEAD, "elder_guardian"), + NAUTILUS (27, -1, (v) -> v >= 13, CompatibleMaterial.CONDUIT), + NOTE (28, 23, (v) -> true, "note", Material.NOTE_BLOCK), + PORTAL (29, 24, (v) -> true, "portal", Material.SOUL_SAND), + REDSTONE (30, 30, (v) -> true, "reddust", Material.REDSTONE, ParticleProperty.DUST_OPTIONS, "dust"), + SLIME (31, 33, (v) -> true, "slime", Material.SLIME_BALL, "item_slime"), + SMOKE_LARGE (32, 12, (v) -> true, "largesmoke", CompatibleMaterial.BONE_MEAL, "large_smoke"), + SMOKE_NORMAL (33, 11, (v) -> true, "smoke", Material.FLINT_AND_STEEL, "smoke"), + SNOW_SHOVEL (34, 32, (v) -> true, Material.SNOW_BLOCK), + SNOWBALL (35, 31, (v) -> true, "snowballpoof", CompatibleMaterial.SNOWBALL, "item_snowball"), + SPELL (36, 13, (v) -> true, "spell", Material.POTION, "effect"), + SPELL_INSTANT (37, 14, (v) -> true, "instantSpell", CompatibleMaterial.SPLASH_POTION, "instant_effect"), + SPELL_MOB (38, 15, (v) -> v <= 20.4, "mobSpell", CompatibleMaterial.ZOMBIE_HEAD), + SPELL_MOB_AMBIENT (39, 16, (v) -> true, "mobSpellAmbient", Material.POTION), + SPELL_WITCH (40, 17, (v) -> true, "witchMagic", CompatibleMaterial.SPLASH_POTION, "witch"), + SPIT (41, 48, (v) -> v >= 11, "spit", CompatibleMaterial.BONE_MEAL), + SQUID_INK (42, -1, (v) -> v >= 13, CompatibleMaterial.INK_SAC), + SUSPENDED (43, 7, (v) -> true, "suspended", Material.BEDROCK, "underwater"), + SUSPENDED_DEPTH (44, 8, (v) -> true, "depthSuspend", Material.BEDROCK), + SWEEP_ATTACK (45, 45, (v) -> v >= 9, "sweepAttack", Material.DIAMOND_SWORD), + TOTEM (46, 47, (v) -> v >= 11, "totem", CompatibleMaterial.TOTEM_OF_UNDYING, "totem_of_undying"), + TOWN_AURA (47, 22, (v) -> true, "townaura", Material.BEACON, "mycelium"), + VILLAGER_ANGRY (48, 20, (v) -> true, "angryVillager", CompatibleMaterial.WITHER_SKELETON_SKULL, "angry_villager"), + VILLAGER_HAPPY (49, 21, (v) -> true, "happyVillager", CompatibleMaterial.PLAYER_HEAD, "happy_villager"), + WATER_BUBBLE (50, 4, (v) -> true, "bubble", Material.FISHING_ROD, "bubble"), + WATER_DROP (51, 39, (v) -> v >= 8, Material.WATER_BUCKET, "rain"), + WATER_SPLASH (52, 5, (v) -> true, "splash", CompatibleMaterial.BIRCH_BOAT, "splash"), + WATER_WAKE (53, 6, (v) -> v >= 7, "wake", CompatibleMaterial.OAK_BOAT, "fishing"), + ITEMSTACK (54, -1, (v) -> true, Material.DIAMOND, ParticleProperty.ITEMSTACK_DATA), + CAMPFIRE_COSY_SMOKE (55, -1, (v) -> v >= 14, CompatibleMaterial.CAMPFIRE), + CAMPFIRE_SIGNAL_SMOKE (56, -1, (v) -> v >= 14, CompatibleMaterial.CAMPFIRE), + COMPOSTER (57, -1, (v) -> v >= 14, CompatibleMaterial.COMPOSTER), + FALLING_LAVA (58, -1, (v) -> v >= 14, Material.LAVA_BUCKET), + FALLING_WATER (59, -1, (v) -> v >= 14, Material.WATER_BUCKET), + FLASH (60, -1, (v) -> v >= 14, CompatibleMaterial.LANTERN), + SNEEZE (61, -1, (v) -> v >= 14, CompatibleMaterial.GRAY_DYE), + EMPTY_SPACE (62, -1, (v) -> true, CompatibleMaterial.BARRIER), + LANDING_LAVA (63, -1, (v) -> v >= 14, Material.MAGMA_CREAM), + DRIPPING_HONEY (64, -1, (v) -> v >= 15, CompatibleMaterial.HONEY_BOTTLE), + FALLING_HONEY (65, -1, (v) -> v >= 15, CompatibleMaterial.HONEYCOMB), + FALLING_NECTAR (66, -1, (v) -> v >= 15, CompatibleMaterial.DANDELION), + LANDING_HONEY (67, -1, (v) -> v >= 15, CompatibleMaterial.HONEY_BOTTLE), + SOUL_FIRE_FLAME (68, -1, (v) -> v >= 16, CompatibleMaterial.SOUL_CAMPFIRE), + ASH (69, -1, (v) -> v >= 16, CompatibleMaterial.BLACK_DYE), + CRIMSON_SPORE (70, -1, (v) -> v >= 16, CompatibleMaterial.CRIMSON_FUNGUS), + WARPED_SPORE (71, -1, (v) -> v >= 16, CompatibleMaterial.WARPED_FUNGUS), + SOUL (72, -1, (v) -> v >= 16, CompatibleMaterial.SOUL_LANTERN), + DRIPPING_OBSIDIAN_TEAR (73, -1, (v) -> v >= 16, CompatibleMaterial.CRYING_OBSIDIAN), + FALLING_OBSIDIAN_TEAR (74, -1, (v) -> v >= 16, CompatibleMaterial.CRYING_OBSIDIAN), + LANDING_OBSIDIAN_TEAR (75, -1, (v) -> v >= 16, CompatibleMaterial.CRYING_OBSIDIAN), + REVERSE_PORTAL (76, -1, (v) -> v >= 16, Material.OBSIDIAN), + WHITE_ASH (77, -1, (v) -> v >= 16, CompatibleMaterial.WHITE_DYE), + LIGHT (78, -1, (v) -> v >= 17, CompatibleMaterial.LIGHT), - DUST_COLOR_TRANSITION (79, -1, 17, Material.REDSTONE, ParticleProperty.COLOR_TRANSITION), + DUST_COLOR_TRANSITION (79, -1, (v) -> v >= 17, Material.REDSTONE, ParticleProperty.COLOR_TRANSITION), // TODO: Implement way for storing vibration particle data //VIBRATION (80, -1, 17, Material.BEDROCK), - FALLING_SPORE_BLOSSOM (81, -1, 17, CompatibleMaterial.SPORE_BLOSSOM), - SPORE_BLOSSOM_AIR (82, -1, 17, CompatibleMaterial.SPORE_BLOSSOM), - SMALL_FLAME (83, -1, 17, CompatibleMaterial.CYAN_CANDLE), - SNOWFLAKE (84, -1, 17, CompatibleMaterial.POWDER_SNOW_BUCKET), - DRIPPING_DRIPSTONE_LAVA (85, -1, 17, CompatibleMaterial.POINTED_DRIPSTONE), - FALLING_DRIPSTONE_LAVA (86, -1, 17, CompatibleMaterial.DRIPSTONE_BLOCK), - DRIPPING_DRIPSTONE_WATER (87, -1, 17, CompatibleMaterial.POINTED_DRIPSTONE), - FALLING_DRIPSTONE_WATER (88, -1, 17, CompatibleMaterial.DRIPSTONE_BLOCK), - GLOW_SQUID_INK (89, -1, 17, CompatibleMaterial.GLOW_INK_SAC), - GLOW (90, -1, 17, CompatibleMaterial.GLOW_INK_SAC), - WAX_ON (91, -1, 17, CompatibleMaterial.COPPER_BLOCK), - WAX_OFF (92, -1, 17, CompatibleMaterial.WEATHERED_COPPER), - ELECTRIC_SPARK (93, -1, 17, CompatibleMaterial.LIGHTNING_ROD), - SCRAPE (94, -1, 17, CompatibleMaterial.OXIDIZED_COPPER), - BLOCK_MARKER (95, -1, 18, Material.ITEM_FRAME, ParticleProperty.BLOCK_DATA), - SONIC_BOOM (96, -1, 19, CompatibleMaterial.SCULK), - SCULK_SOUL (97, -1, 19, CompatibleMaterial.SCULK_CATALYST), - SCULK_CHARGE (98, -1, 19, CompatibleMaterial.SCULK_SENSOR, ParticleProperty.FLOAT), - SCULK_CHARGE_POP (99, -1, 19, CompatibleMaterial.SCULK_VEIN), - SHRIEK (100, -1, 19, CompatibleMaterial.SCULK_SHRIEKER, ParticleProperty.INTEGER), - CHERRY_LEAVES(101, -1, 20, CompatibleMaterial.CHERRY_LEAVES), + FALLING_SPORE_BLOSSOM (81, -1, (v) -> v >= 17, CompatibleMaterial.SPORE_BLOSSOM), + SPORE_BLOSSOM_AIR (82, -1, (v) -> v >= 17, CompatibleMaterial.SPORE_BLOSSOM), + SMALL_FLAME (83, -1, (v) -> v >= 17, CompatibleMaterial.CYAN_CANDLE), + SNOWFLAKE (84, -1, (v) -> v >= 17, CompatibleMaterial.POWDER_SNOW_BUCKET), + DRIPPING_DRIPSTONE_LAVA (85, -1, (v) -> v >= 17, CompatibleMaterial.POINTED_DRIPSTONE), + FALLING_DRIPSTONE_LAVA (86, -1, (v) -> v >= 17, CompatibleMaterial.DRIPSTONE_BLOCK), + DRIPPING_DRIPSTONE_WATER (87, -1, (v) -> v >= 17, CompatibleMaterial.POINTED_DRIPSTONE), + FALLING_DRIPSTONE_WATER (88, -1, (v) -> v >= 17, CompatibleMaterial.DRIPSTONE_BLOCK), + GLOW_SQUID_INK (89, -1, (v) -> v >= 17, CompatibleMaterial.GLOW_INK_SAC), + GLOW (90, -1, (v) -> v >= 17, CompatibleMaterial.GLOW_INK_SAC), + WAX_ON (91, -1, (v) -> v >= 17, CompatibleMaterial.COPPER_BLOCK), + WAX_OFF (92, -1, (v) -> v >= 17, CompatibleMaterial.WEATHERED_COPPER), + ELECTRIC_SPARK (93, -1, (v) -> v >= 17, CompatibleMaterial.LIGHTNING_ROD), + SCRAPE (94, -1, (v) -> v >= 17, CompatibleMaterial.OXIDIZED_COPPER), + + BLOCK_MARKER (95, -1, (v) -> v >= 18, Material.ITEM_FRAME, ParticleProperty.BLOCK_DATA), + + SONIC_BOOM (96, -1, (v) -> v >= 19, CompatibleMaterial.SCULK), + SCULK_SOUL (97, -1, (v) -> v >= 19, CompatibleMaterial.SCULK_CATALYST), + SCULK_CHARGE (98, -1, (v) -> v >= 19, CompatibleMaterial.SCULK_SENSOR, ParticleProperty.FLOAT), + SCULK_CHARGE_POP (99, -1, (v) -> v >= 19, CompatibleMaterial.SCULK_VEIN), + SHRIEK (100, -1, (v) -> v >= 19, CompatibleMaterial.SCULK_SHRIEKER, ParticleProperty.INTEGER), + + CHERRY_LEAVES(101, -1, (v) -> v >= 20, CompatibleMaterial.CHERRY_LEAVES), + + // Changes in 1.20.5 + ENTITY_EFFECT (102, -1, (v) -> v >= 20.5, CompatibleMaterial.ZOMBIE_HEAD, ParticleProperty.COLOR), + EGG_CRACK (103, -1, (v) -> v >= 20.5, Material.EGG), + DUST_PLUME (104, -1, (v) -> v >= 20.5, Material.REDSTONE), + WHITE_SMOKE (105, -1, (v) -> v >= 20.5, CompatibleMaterial.WHITE_DYE), ; private static final Map particleNames = new HashMap(); @@ -127,10 +137,11 @@ public enum ParticleEffect { private final int id; private final int legacyID; - private final double version; + private final Predicate predicate; private final String legacyName; private final ItemStack item; private final ParticleProperty property; + public final String[] aliases; static { @@ -140,48 +151,49 @@ public enum ParticleEffect { particleLegacyNames.put(pe.legacyName, pe); particleIDs.put(pe.id, pe); } - } +} - private ParticleEffect (final int id, final int legacyID, final double version, String legacyName, final ItemStack item, final ParticleProperty property) + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, String legacyName, final ItemStack item, final ParticleProperty property, String... aliases) { this.id = id; this.legacyID = legacyID; - this.version = version; + this.predicate = predicate; this.legacyName = legacyName; this.item = item; this.property = property; + this.aliases = aliases; } - private ParticleEffect (final int id, final int legacyID, final double version, String legacyName, final Material material, final ParticleProperty property) { - this(id, legacyID, version, legacyName, ItemUtil.createItem(material, 1), property); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, String legacyName, final Material material, final ParticleProperty property, String... aliases) { + this(id, legacyID, predicate, legacyName, ItemUtil.createItem(material, 1), property, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final String legacyName, final CompatibleMaterial material, final ParticleProperty property) { - this(id, legacyID, version, legacyName, material.getItem(), property); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final String legacyName, final CompatibleMaterial material, final ParticleProperty property, String... aliases) { + this(id, legacyID, predicate, legacyName, material.getItem(), property, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final String legacyName, final Material material) { - this(id, legacyID, version, legacyName, ItemUtil.createItem(material, 1), ParticleProperty.NO_DATA); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final String legacyName, final Material material, String... aliases) { + this(id, legacyID, predicate, legacyName, ItemUtil.createItem(material, 1), ParticleProperty.NO_DATA, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final String legacyName, final CompatibleMaterial material) { - this(id, legacyID, version, legacyName, material.getItem(), ParticleProperty.NO_DATA); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final String legacyName, final CompatibleMaterial material, String... aliases) { + this(id, legacyID, predicate, legacyName, material.getItem(), ParticleProperty.NO_DATA, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final CompatibleMaterial material, final ParticleProperty property) { - this(id, legacyID, version, "", material.getItem(), property); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final CompatibleMaterial material, final ParticleProperty property, String... aliases) { + this(id, legacyID, predicate, "", material.getItem(), property, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final Material material, final ParticleProperty property) { - this(id, legacyID, version, "", ItemUtil.createItem(material, 1), property); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final Material material, final ParticleProperty property, String... aliases) { + this(id, legacyID, predicate, "", ItemUtil.createItem(material, 1), property, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final CompatibleMaterial material) { - this(id, legacyID, version, "", material.getItem(), ParticleProperty.NO_DATA); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final CompatibleMaterial material, String... aliases) { + this(id, legacyID, predicate, "", material.getItem(), ParticleProperty.NO_DATA, aliases); } - private ParticleEffect (final int id, final int legacyID, final double version, final Material material) { - this(id, legacyID, version, "", ItemUtil.createItem(material, 1), ParticleProperty.NO_DATA); + private ParticleEffect (final int id, final int legacyID, final Predicate predicate, final Material material, String... aliases) { + this(id, legacyID, predicate, "", ItemUtil.createItem(material, 1), ParticleProperty.NO_DATA, aliases); } /** @@ -189,7 +201,7 @@ public enum ParticleEffect { * @return True if this ParticleEffect uses color data */ public boolean hasColorData () { - return property.equals(ParticleProperty.COLOR) || property.equals(ParticleProperty.COLOR_TRANSITION); + return property.equals(ParticleProperty.DUST_OPTIONS) || property.equals(ParticleProperty.COLOR_TRANSITION) || property.equals(ParticleProperty.COLOR); } /** @@ -232,14 +244,6 @@ public enum ParticleEffect { return legacyID; } - /** - * Returns the server version required to use this particle (1.x) - * @return - */ - public double getRequiredVersion () { - return version; - } - /** * Get the string name of this enum * @return @@ -312,12 +316,8 @@ public enum ParticleEffect { return property; } - public boolean isSupported () - { - if (version == -1) { - return true; - } - return ParticleHats.serverVersion >= version; + public boolean isSupported () { + return predicate.test(ParticleHats.serverVersion); } /** @@ -347,8 +347,6 @@ public enum ParticleEffect { return NONE; } - //String particle = name.toLowerCase(); - if (particleNames.containsKey(name)) { return particleNames.get(name); } @@ -398,8 +396,9 @@ public enum ParticleEffect { public static enum ParticleProperty { NO_DATA, - COLOR, + DUST_OPTIONS, COLOR_TRANSITION, + COLOR, BLOCK_DATA, ITEM_DATA, ITEMSTACK_DATA,