类 ParticleDescriptionProvider
- 所有已实现的接口:
DataProvider
ParticleDescription
s.
To use this provider, extend this class and implement addDescriptions()
.
Then, register an instance using DataGenerator.addProvider(boolean, Factory)
via the GatherDataEvent
on the mod event bus.
A description can be added to a ParticleType
which uses a sprite
or sprite set.
@Override
protected void addDescriptions() {
// Single sprite
this.sprite(ParticleTypes.DRIPPING_LAVA, new ResourceLocation("drip_hang"));
// Multiple sprites
this.spriteSet(ParticleTypes.CLOUD, new ResourceLocation("generic"), 8, true);
}
A particle description holds a list of textures used when rendering the
particle to the screen. All registered particle descriptions are stitched
together into a texture atlas called TextureAtlas.LOCATION_PARTICLES
.
A ParticleType
whose particle uses the texture atlas, typically via
the ParticleRenderType
, can then reference
the necessary texture during rendering.
Particles with a particle description must have their particle providers
attached to a ParticleType
as a sprite
or sprite set
consumer.
- 另请参阅:
-
嵌套类概要
从接口继承的嵌套类/接口 net.minecraft.data.DataProvider
DataProvider.Factory<T extends DataProvider>
-
字段概要
字段修饰符和类型字段说明protected final Map
<ResourceLocation, List<String>> protected final ExistingFileHelper
private final PackOutput.PathProvider
从接口继承的字段 net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, KEY_COMPARATOR, LOGGER
-
构造器概要
构造器限定符构造器说明protected
ParticleDescriptionProvider
(PackOutput output, ExistingFileHelper fileHelper) Creates an instance of the data provider. -
方法概要
修饰符和类型方法说明protected abstract void
Registers the particle descriptions generated bysprite(ParticleType, ResourceLocation)
or one of thesprite set methods
.getName()
run
(CachedOutput cache) protected void
sprite
(ParticleType<?> type, ResourceLocation texture) Creates a new particle description that contains a single texture for the associatedParticleType
.protected void
spriteSet
(ParticleType<?> type, Iterable<ResourceLocation> textures) Creates a new particle description that contains multiple textures for the associatedParticleType
.protected void
spriteSet
(ParticleType<?> type, ResourceLocation baseName, int numOfTextures, boolean reverse) Creates a new particle description that contains multiple textures for the associatedParticleType
.protected void
spriteSet
(ParticleType<?> type, ResourceLocation texture, ResourceLocation... textures) Creates a new particle description that contains multiple textures for the associatedParticleType
.
-
字段详细资料
-
particlesPath
-
fileHelper
-
descriptions
-
-
构造器详细资料
-
ParticleDescriptionProvider
Creates an instance of the data provider.- 参数:
output
- the expected root directory the data generator outputs tofileHelper
- the helper used to validate a texture's existence
-
-
方法详细资料
-
addDescriptions
protected abstract void addDescriptions()Registers the particle descriptions generated bysprite(ParticleType, ResourceLocation)
or one of thesprite set methods
. -
sprite
Creates a new particle description that contains a single texture for the associatedParticleType
.Particle types with this description should be attached to a particle provider via
RegisterParticleProvidersEvent.registerSprite(ParticleType, ParticleProvider.Sprite)
.- 参数:
type
- the particle type the textures are applied fortexture
- the texture to render for the particle type- 抛出:
NullPointerException
- if the particle type is not registeredIllegalArgumentException
- if a texture does not have an associated PNG file, or the particle type has already been provided
-
spriteSet
protected void spriteSet(ParticleType<?> type, ResourceLocation baseName, int numOfTextures, boolean reverse) Creates a new particle description that contains multiple textures for the associatedParticleType
. The textures are generated from a common name and appended with a number representing the state of the animation.minecraft:generic_0 minecraft:generic_1 minecraft:generic_2 // ...
Particle types with this description should be attached to a particle provider via
RegisterParticleProvidersEvent.registerSpriteSet(ParticleType, ParticleEngine.SpriteParticleRegistration)
.- 参数:
type
- the particle type the textures are applied forbaseName
- the common name of all the texturesnumOfTextures
- the number of textures within the setreverse
- whentrue
, the textures will be listed in descending order- 抛出:
NullPointerException
- if the particle type is not registeredIllegalArgumentException
- if a texture does not have an associated PNG file, or the particle type has already been provided
-
spriteSet
protected void spriteSet(ParticleType<?> type, ResourceLocation texture, ResourceLocation... textures) Creates a new particle description that contains multiple textures for the associatedParticleType
. The textures are passed as varargs with at least one texture present.Particle types with this description should be attached to a particle provider via
RegisterParticleProvidersEvent.registerSpriteSet(ParticleType, ParticleEngine.SpriteParticleRegistration)
.- 参数:
type
- the particle type the textures are applied fortexture
- the first texture in the descriptiontextures
- a list of subsequent textures to render for the particle type- 抛出:
NullPointerException
- if the particle type is not registeredIllegalArgumentException
- if a texture does not have an associated PNG file, or the particle type has already been provided
-
spriteSet
Creates a new particle description that contains multiple textures for the associatedParticleType
. The textures are passed as an iterable.Particle types with this description should be attached to a particle provider via
RegisterParticleProvidersEvent.registerSpriteSet(ParticleType, ParticleEngine.SpriteParticleRegistration)
.- 参数:
type
- the particle type the textures are applied fortextures
- a list of textures to render for the particle type- 抛出:
NullPointerException
- if the particle type is not registeredIllegalArgumentException
- if there are no textures provided, a texture does not have an associated PNG file, or the particle type has already been provided
-
run
- 指定者:
run
在接口中DataProvider
-
getName
- 指定者:
getName
在接口中DataProvider
-