Package net.minecraft.client.particle
Class ParticleManager
java.lang.Object
net.minecraft.client.particle.ParticleManager
- All Implemented Interfaces:
ResourceReloader
@Environment(CLIENT) public class ParticleManager extends Object implements ResourceReloader
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classParticleManager.SimpleSpriteProvider(package private) static interfaceParticleManager.SpriteAwareFactory<T extends ParticleEffect>Nested classes/interfaces inherited from interface net.minecraft.resource.ResourceReloader
ResourceReloader.Synchronizer -
Field Summary
Fields Modifier and Type Field Description private Int2ObjectMap<ParticleFactory<?>>factoriesprivate Queue<EmitterParticle>newEmitterParticlesprivate Queue<Particle>newParticlesprivate static List<ParticleTextureSheet>PARTICLE_TEXTURE_SHEETSprivate SpriteAtlasTextureparticleAtlasTextureprivate Map<ParticleTextureSheet,Queue<Particle>>particlesprivate Randomrandomprivate Map<Identifier,ParticleManager.SimpleSpriteProvider>spriteAwareFactoriesprivate TextureManagertextureManagerprotected ClientWorldworld -
Constructor Summary
Constructors Constructor Description ParticleManager(ClientWorld world, TextureManager textureManager) -
Method Summary
Modifier and Type Method Description voidaddBlockBreakingParticles(BlockPos pos, Direction direction)voidaddBlockBreakParticles(BlockPos pos, BlockState state)voidaddEmitter(Entity entity, ParticleEffect parameters)voidaddEmitter(Entity entity, ParticleEffect parameters, int maxAge)voidaddParticle(Particle particle)ParticleaddParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)voidclearAtlas()private <T extends ParticleEffect>
ParticlecreateParticle(T parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ)StringgetDebugString()private voidloadTextureList(ResourceManager resourceManager, Identifier id, Map<Identifier,List<Identifier>> result)private voidregisterDefaultFactories()private <T extends ParticleEffect>
voidregisterFactory(ParticleType<T> type, ParticleFactory<T> factory)private <T extends ParticleEffect>
voidregisterFactory(ParticleType<T> type, ParticleManager.SpriteAwareFactory<T> factory)CompletableFuture<Void>reload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor, Executor applyExecutor)Performs a reload.voidrenderParticles(MatrixStack matrices, VertexConsumerProvider.Immediate immediate, LightmapTextureManager lightmapTextureManager, Camera camera, float float2)voidsetWorld(ClientWorld world)voidtick()private voidtickParticle(Particle particle)private voidtickParticles(Collection<Particle> particles)Ticks all particles belonging to the same texture sheet.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.resource.ResourceReloader
getName
-
Field Details
-
PARTICLE_TEXTURE_SHEETS
-
world
-
particles
-
newEmitterParticles
-
textureManager
-
random
-
factories
-
newParticles
-
spriteAwareFactories
-
particleAtlasTexture
-
-
Constructor Details
-
ParticleManager
-
-
Method Details
-
registerDefaultFactories
private void registerDefaultFactories() -
registerFactory
private <T extends ParticleEffect> void registerFactory(ParticleType<T> type, ParticleFactory<T> factory) -
registerFactory
private <T extends ParticleEffect> void registerFactory(ParticleType<T> type, ParticleManager.SpriteAwareFactory<T> factory) -
reload
public CompletableFuture<Void> reload(ResourceReloader.Synchronizer synchronizer, ResourceManager manager, Profiler prepareProfiler, Profiler applyProfiler, Executor prepareExecutor, Executor applyExecutor)Performs a reload. Returns a future that is completed when the reload is completed.In a reload, there is a prepare stage and an apply stage. For the prepare stage, you should create completable futures with CompletableFuture.supplyAsync(..., prepareExecutor) to ensure the prepare actions are done with the prepare executor. Then, you should have a completable future for all the prepared actions, and call combinedPrepare.thenCompose(synchronizer::waitFor) to notify the
synchronizer. Finally, you should run CompletableFuture.thenAcceptAsync(..., applyExecutor) for apply actions. In the end, returns the result ofthenAcceptAsync.- Specified by:
reloadin interfaceResourceReloader- Parameters:
synchronizer- the synchronizermanager- the resource managerprepareProfiler- the profiler for prepare stageapplyProfiler- the profiler for apply stageprepareExecutor- the executor for prepare stageapplyExecutor- the executor for apply stage- Returns:
- a future for the reload
- See Also:
ReloadableResourceManager.reload(Executor, Executor, CompletableFuture, List)
-
clearAtlas
public void clearAtlas() -
loadTextureList
private void loadTextureList(ResourceManager resourceManager, Identifier id, Map<Identifier,List<Identifier>> result) -
addEmitter
-
addEmitter
-
addParticle
@Nullable public Particle addParticle(ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) -
createParticle
@Nullable private <T extends ParticleEffect> Particle createParticle(T parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) -
addParticle
-
tick
public void tick() -
tickParticles
Ticks all particles belonging to the same texture sheet.- Parameters:
particles- a collection of particles from the same sheet
-
tickParticle
-
renderParticles
public void renderParticles(MatrixStack matrices, VertexConsumerProvider.Immediate immediate, LightmapTextureManager lightmapTextureManager, Camera camera, float float2) -
setWorld
-
addBlockBreakParticles
-
addBlockBreakingParticles
-
getDebugString
-