package org.bukkit; import com.google.common.base.Preconditions; import org.bukkit.block.data.BlockData; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; import org.jetbrains.annotations.NotNull; public enum Particle { EXPLOSION_NORMAL, EXPLOSION_LARGE, EXPLOSION_HUGE, FIREWORKS_SPARK, WATER_BUBBLE, WATER_SPLASH, WATER_WAKE, SUSPENDED, SUSPENDED_DEPTH, CRIT, CRIT_MAGIC, SMOKE_NORMAL, SMOKE_LARGE, SPELL, SPELL_INSTANT, SPELL_MOB, SPELL_MOB_AMBIENT, SPELL_WITCH, DRIP_WATER, DRIP_LAVA, VILLAGER_ANGRY, VILLAGER_HAPPY, TOWN_AURA, NOTE, PORTAL, ENCHANTMENT_TABLE, FLAME, LAVA, CLOUD, /** * Uses {@link Particle.DustOptions} as DataType */ REDSTONE(DustOptions.class), SNOWBALL, SNOW_SHOVEL, SLIME, HEART, /** * Uses {@link ItemStack} as DataType */ ITEM_CRACK(ItemStack.class), /** * Uses {@link BlockData} as DataType */ BLOCK_CRACK(BlockData.class), /** * Uses {@link BlockData} as DataType */ BLOCK_DUST(BlockData.class), WATER_DROP, MOB_APPEARANCE, DRAGON_BREATH, END_ROD, DAMAGE_INDICATOR, SWEEP_ATTACK, /** * Uses {@link BlockData} as DataType */ FALLING_DUST(BlockData.class), TOTEM, SPIT, SQUID_INK, BUBBLE_POP, CURRENT_DOWN, BUBBLE_COLUMN_UP, NAUTILUS, DOLPHIN, SNEEZE, CAMPFIRE_COSY_SMOKE, CAMPFIRE_SIGNAL_SMOKE, COMPOSTER, FLASH, FALLING_LAVA, LANDING_LAVA, FALLING_WATER, DRIPPING_HONEY, FALLING_HONEY, LANDING_HONEY, FALLING_NECTAR, SOUL_FIRE_FLAME, ASH, CRIMSON_SPORE, WARPED_SPORE, SOUL, DRIPPING_OBSIDIAN_TEAR, FALLING_OBSIDIAN_TEAR, LANDING_OBSIDIAN_TEAR, REVERSE_PORTAL, WHITE_ASH, /** * Uses {@link DustTransition} as DataType */ DUST_COLOR_TRANSITION(DustTransition.class), /** * Uses {@link Vibration} as DataType */ VIBRATION(Vibration.class), FALLING_SPORE_BLOSSOM, SPORE_BLOSSOM_AIR, SMALL_FLAME, SNOWFLAKE, DRIPPING_DRIPSTONE_LAVA, FALLING_DRIPSTONE_LAVA, DRIPPING_DRIPSTONE_WATER, FALLING_DRIPSTONE_WATER, GLOW_SQUID_INK, GLOW, WAX_ON, WAX_OFF, ELECTRIC_SPARK, SCRAPE, SONIC_BOOM, SCULK_SOUL, SCULK_CHARGE(Float.class), SCULK_CHARGE_POP, SHRIEK(Integer.class), DRIPPING_CHERRY_LEAVES, FALLING_CHERRY_LEAVES, LANDING_CHERRY_LEAVES, /** * Uses {@link BlockData} as DataType */ BLOCK_MARKER(BlockData.class), // ----- Legacy Separator ----- /** * Uses {@link MaterialData} as DataType */ LEGACY_BLOCK_CRACK(MaterialData.class), /** * Uses {@link MaterialData} as DataType */ LEGACY_BLOCK_DUST(MaterialData.class), /** * Uses {@link MaterialData} as DataType */ LEGACY_FALLING_DUST(MaterialData.class); private final Class dataType; Particle() { dataType = Void.class; } Particle(/*@NotNull*/ Class data) { dataType = data; } /** * Returns the required data type for the particle * @return the required data type */ @NotNull public Class getDataType() { return dataType; } /** * Options which can be applied to redstone dust particles - a particle * color and size. */ public static class DustOptions { private final Color color; private final float size; public DustOptions(@NotNull Color color, float size) { Preconditions.checkArgument(color != null, "color"); this.color = color; this.size = size; } /** * The color of the particles to be displayed. * * @return particle color */ @NotNull public Color getColor() { return color; } /** * Relative size of the particle. * * @return relative particle size */ public float getSize() { return size; } } /** * Options which can be applied to a color transitioning dust particles. */ public static class DustTransition extends DustOptions { private final Color toColor; public DustTransition(@NotNull Color fromColor, @NotNull Color toColor, float size) { super(fromColor, size); Preconditions.checkArgument(toColor != null, "toColor"); this.toColor = toColor; } /** * The final of the particles to be displayed. * * @return final particle color */ @NotNull public Color getToColor() { return toColor; } } }