org.spongepowered.api.effect.particle.ParticleOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spongeapi Show documentation
Show all versions of spongeapi Show documentation
A plugin API for Minecraft: Java Edition
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.effect.particle;
import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.effect.potion.PotionEffectType;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.api.registry.DefaultedRegistryReference;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;
import org.spongepowered.api.util.Color;
import org.spongepowered.api.util.Direction;
import org.spongepowered.math.vector.Vector3d;
/**
* An enumeration of all possible {@link ParticleOption}s in vanilla minecraft.
*/
@SuppressWarnings("unused")
@RegistryScopes(scopes = RegistryScope.GAME)
public final class ParticleOptions {
// @formatter:off
// SORTFIELDS:ON
/**
* This option will affect the appearance of a particle. The only vanilla
* {@link ParticleType}s that this option is applicable to are:
*
*
* - {@link ParticleTypes#BLOCK}
* - {@link ParticleTypes#FALLING_DUST}
* - {@link ParticleTypes#ITEM}
*
*/
public static final DefaultedRegistryReference> BLOCK_STATE = ParticleOptions.key(ResourceKey.sponge("block_state"));
/**
* This option will modify the color of a particle. The only vanilla
* {@link ParticleType}s this option is applicable to are:
*
*
* - {@link ParticleTypes#AMBIENT_ENTITY_EFFECT}
* - {@link ParticleTypes#ENTITY_EFFECT}
* - {@link ParticleTypes#DUST}
*
*/
public static final DefaultedRegistryReference> COLOR = ParticleOptions.key(ResourceKey.sponge("color"));
/**
* This option will change the direction of a particle.
*/
public static final DefaultedRegistryReference> DIRECTION = ParticleOptions.key(ResourceKey.sponge("direction"));
// /** TODO
// * This option will modify the color of a particle. The only vanilla
// * {@link ParticleType}s this option is applicable to is
// * {@link ParticleTypes#FIREWORKS}.
// *
// * The {@link List} may never be empty. Or a {@link IllegalArgumentException}
// * will be thrown when applying.
// */
// public static final Supplier>> FIREWORK_EFFECTS = Sponge.getRegistry().getCatalogRegistry().provideSupplier(ParticleOption.class, "firework_effects");
/**
* This option will affect the appearance of a particle. The only vanilla
* {@link ParticleType} this option is applicable to are:
*
*
* - {@link ParticleTypes#BLOCK}
* - {@link ParticleTypes#FALLING_DUST}
* - {@link ParticleTypes#ITEM}
*
*/
public static final DefaultedRegistryReference> ITEM_STACK_SNAPSHOT = ParticleOptions.key(ResourceKey.sponge("item_stack_snapshot"));
// /** TODO
// * This option will affect the appearance of a particle. The only vanilla
// * {@link ParticleType} this option is applicable to is
// * {@link ParticleTypes#NOTE}.
// */
// public static final Supplier> NOTE = Sponge.getRegistry().getCatalogRegistry().provideSupplier(ParticleOption.class, "note");
/**
* This option will affect how all the particles are spread.
*/
public static final DefaultedRegistryReference> OFFSET = ParticleOptions.key(ResourceKey.sponge("offset"));
/**
* This option will change the potion type of a particle. The only vanilla
* {@link ParticleType}s this option is applicable to is
*/
public static final DefaultedRegistryReference> POTION_EFFECT_TYPE = ParticleOptions.key(ResourceKey.sponge("potion_effect_type"));
/**
* This option will affect the amount of particles that are spawned. The
* minimum amount of particles is 1. The only vanilla {@link ParticleType}s
* this option isn't applicable to are:
*
*
* - {@link ParticleTypes#BLOCK}
* - {@link ParticleTypes#FIREWORK}
*
*
* The quantity must be at least 1, or a {@link IllegalArgumentException}
* will be thrown when applying.
*/
public static final DefaultedRegistryReference> QUANTITY = ParticleOptions.key(ResourceKey.sponge("quantity"));
/**
* This option will change the scale of a particle. The only
* vanilla {@link ParticleType}s this option is applicable to is:
*
*
* - {@link ParticleTypes#DUST}
*
*
* The scale may never be negative, or a {@link IllegalArgumentException}
* will be thrown when applying.
*/
public static final DefaultedRegistryReference> SCALE = ParticleOptions.key(ResourceKey.sponge("scale"));
// /** TODO
// * This option will affect whether a particle type will have a lower
// * velocity in the horizontal plane. The only vanilla {@link ParticleType}s
// * that this option will affect are:
// *
// *
// * - {@link ParticleTypes#EFFECT}
// * - {@link ParticleTypes#INSTANT_EFFECT}
// * - {@link ParticleTypes#WITCH_MAGIC}
// *
// *
// * These particle types don't have a configurable velocity (through
// * {@link #VELOCITY}) in the horizontal plane.
// */
// public static final Supplier> SLOW_HORIZONTAL_VELOCITY = Sponge.getRegistry().getCatalogRegistry().provideSupplier(ParticleOption.class, "slow_horizontal_velocity");
/**
* This option will affect how most particles are moving.
*/
public static final DefaultedRegistryReference> VELOCITY = ParticleOptions.key(ResourceKey.sponge("velocity"));
// SORTFIELDS:OFF
// @formatter:on
private ParticleOptions() {
}
public static Registry> registry() {
return Sponge.game().registry(RegistryTypes.PARTICLE_OPTION);
}
private static DefaultedRegistryReference> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.PARTICLE_OPTION, location).asDefaultedReference(Sponge::game);
}
}