Class ParticleWizardry
java.lang.Object
net.minecraft.client.particle.Particle
net.minecraft.client.particle.SingleQuadParticle
net.minecraft.client.particle.TextureSheetParticle
com.binaris.wizardry.api.client.particle.ParticleWizardry
- Direct Known Subclasses:
ParticleBuff,ParticleCloud,ParticleDarkMagic,ParticleDust,ParticleFlash,ParticleIce,ParticleLeaf,ParticleLightningPulse,ParticleMagicBubble,ParticleMagicFire,ParticlePath,ParticleScorch,ParticleSnow,ParticleSpark,ParticleSparkle,ParticleSphere,ParticleTargeted
public abstract class ParticleWizardry
extends net.minecraft.client.particle.TextureSheetParticle
Abstract superclass for all of wizardry's particles.
The new system is as follows:
- All particle classes have a single constructor which takes a world and a position only.
- Each particle class defines any relevant default values in its constructor, including velocity.
- The particle builder then overwrites any other values that were set during building.
- Each particle class defines any relevant default values in its constructor, including velocity.
- The particle builder then overwrites any other values that were set during building.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected floatprotected @Nullable net.minecraft.world.entity.EntityThe entity this particle is linked to.protected floatprotected floatprotected floatprotected floatprotected floatprotected floatprotected floatThe pitch angle this particle is facing, orNaNif this particle always faces the viewer (default behaviour).static final Map<net.minecraft.core.particles.SimpleParticleType,BiFunction<net.minecraft.client.multiplayer.ClientLevel, net.minecraft.world.phys.Vec3, ParticleWizardry>> protected doubleprotected Randomprotected doubleVelocity of this particle relative to the linked entity.protected doubleVelocity of this particle relative to the linked entity.protected doubleVelocity of this particle relative to the linked entity.protected doubleCoordinates of this particle relative to the linked entity.protected doubleCoordinates of this particle relative to the linked entity.protected doubleCoordinates of this particle relative to the linked entity.protected longA long value used by the renderer as a random number seed, ensuring anything that is randomized remains the same across multiple frames.protected booleanTrue if the particle is shaded, false if the particle always renders at full brightness.protected doubleprotected floatThe yaw angle this particle is facing, orNaNif this particle always faces the viewer (default behaviour).Fields inherited from class net.minecraft.client.particle.TextureSheetParticle
spriteFields inherited from class net.minecraft.client.particle.SingleQuadParticle
quadSizeFields inherited from class net.minecraft.client.particle.Particle
age, alpha, bbHeight, bbWidth, bCol, friction, gCol, gravity, hasPhysics, level, lifetime, onGround, oRoll, rCol, removed, roll, speedUpWhenYMotionIsBlocked, x, xd, xo, y, yd, yo, z, zd, zo -
Constructor Summary
ConstructorsConstructorDescriptionParticleWizardry(net.minecraft.client.multiplayer.ClientLevel world, double x, double y, double z, net.minecraft.client.particle.SpriteSet spriteSet, boolean updateTextureOnTick) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrawParticle(com.mojang.blaze3d.vertex.VertexConsumer buffer, net.minecraft.client.Camera camera, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) protected intgetLightColor(float f) @NotNull net.minecraft.client.particle.ParticleRenderTypevoidmove(double dx, double dy, double dz) voidrender(@NotNull com.mojang.blaze3d.vertex.VertexConsumer vertexConsumer, net.minecraft.client.Camera camera, float tickDelta) voidsetCollisions(boolean canCollide) Sets this particle's collisions.voidsetColor(float red, float green, float blue) Sets the base color of the particle.voidsetEntity(net.minecraft.world.entity.Entity entity) Links this particle to the given entity.voidsetFacing(float yaw, float pitch) Sets the direction this particle faces.voidsetFadeColour(float r, float g, float b) Sets the fade color of the particle.voidsetGravity(boolean gravity) Sets this particle's gravity.voidsetParticleSpeed(double velocityX, double velocityY, double velocityZ) Sets the velocity of the particle.voidsetSeed(long seed) Sets the seed for this particle's randomly generated values and resetsrandomto use that seed.voidsetShaded(boolean shaded) Sets whether the particle should render at full brightness or not.voidsetSpin(double radius, double speed) Sets the spin parameters of the particle.voidtick()protected voidupdateEntityLinking(float partialTicks) Methods inherited from class net.minecraft.client.particle.TextureSheetParticle
getU0, getU1, getV0, getV1, pickSprite, setSprite, setSpriteFromAgeMethods inherited from class net.minecraft.client.particle.SingleQuadParticle
getQuadSize, scaleMethods inherited from class net.minecraft.client.particle.Particle
getBoundingBox, getLifetime, getParticleGroup, isAlive, remove, setAlpha, setBoundingBox, setLifetime, setLocationFromBoundingbox, setPos, setPower, setSize, toString
-
Field Details
-
PROVIDERS
public static final Map<net.minecraft.core.particles.SimpleParticleType,BiFunction<net.minecraft.client.multiplayer.ClientLevel, PROVIDERSnet.minecraft.world.phys.Vec3, ParticleWizardry>> -
seed
protected long seedA long value used by the renderer as a random number seed, ensuring anything that is randomized remains the same across multiple frames. For example, lightning particles use this to keep their shape across ticks. This value can also be set during particle creation, allowing users to keep randomized properties the same even across multiple particles. If unspecified, the seed is chosen at random. -
random
-
shaded
protected boolean shadedTrue if the particle is shaded, false if the particle always renders at full brightness. Defaults to false. -
initialRed
protected float initialRed -
initialGreen
protected float initialGreen -
initialBlue
protected float initialBlue -
fadeRed
protected float fadeRed -
fadeGreen
protected float fadeGreen -
fadeBlue
protected float fadeBlue -
angle
protected float angle -
radius
protected double radius -
speed
protected double speed -
entity
@Nullable protected @Nullable net.minecraft.world.entity.Entity entityThe entity this particle is linked to. The particle will move with this entity. -
relativeX
protected double relativeXCoordinates of this particle relative to the linked entity. If the linked entity is null, these are used as the absolute coordinates of the centre of rotation for particles with spin. If the particle has neither a linked entity nor spin, these are not used. -
relativeY
protected double relativeYCoordinates of this particle relative to the linked entity. If the linked entity is null, these are used as the absolute coordinates of the centre of rotation for particles with spin. If the particle has neither a linked entity nor spin, these are not used. -
relativeZ
protected double relativeZCoordinates of this particle relative to the linked entity. If the linked entity is null, these are used as the absolute coordinates of the centre of rotation for particles with spin. If the particle has neither a linked entity nor spin, these are not used. -
relativeMotionX
protected double relativeMotionXVelocity of this particle relative to the linked entity. If the linked entity is null, these are not used. -
relativeMotionY
protected double relativeMotionYVelocity of this particle relative to the linked entity. If the linked entity is null, these are not used. -
relativeMotionZ
protected double relativeMotionZVelocity of this particle relative to the linked entity. If the linked entity is null, these are not used. -
yaw
protected float yawThe yaw angle this particle is facing, orNaNif this particle always faces the viewer (default behaviour). -
pitch
protected float pitchThe pitch angle this particle is facing, orNaNif this particle always faces the viewer (default behaviour). -
adjustQuadSize
protected boolean adjustQuadSize
-
-
Constructor Details
-
ParticleWizardry
public ParticleWizardry(net.minecraft.client.multiplayer.ClientLevel world, double x, double y, double z, net.minecraft.client.particle.SpriteSet spriteSet, boolean updateTextureOnTick)
-
-
Method Details
-
setSeed
public void setSeed(long seed) Sets the seed for this particle's randomly generated values and resetsrandomto use that seed. Implementations will differ between particle types; for example, ParticleLightning has an update period which changes the seed every few ticks, whereas ParticleVine simply retains the same seed for its entire lifetime. -
setShaded
public void setShaded(boolean shaded) Sets whether the particle should render at full brightness or not. True if the particle is shaded, false if the particle always renders at full brightness. Defaults to false. -
setGravity
public void setGravity(boolean gravity) Sets this particle's gravity. True to enable gravity, false to disable. Defaults to false. -
setCollisions
public void setCollisions(boolean canCollide) Sets this particle's collisions. True to enable block collisions, false to disable. Defaults to false. -
setParticleSpeed
public void setParticleSpeed(double velocityX, double velocityY, double velocityZ) Sets the velocity of the particle.- Overrides:
setParticleSpeedin classnet.minecraft.client.particle.Particle- Parameters:
velocityX- The x velocityvelocityY- The y velocityvelocityZ- The z velocity
-
setSpin
public void setSpin(double radius, double speed) Sets the spin parameters of the particle.- Parameters:
radius- The spin radiusspeed- The spin speed in rotations per tick
-
setEntity
public void setEntity(net.minecraft.world.entity.Entity entity) Links this particle to the given entity. This will cause its position and velocity to be relative to the entity.- Parameters:
entity- The entity to link to.
-
setColor
public void setColor(float red, float green, float blue) Sets the base color of the particle. Note that this also sets the fade colour so that particles without a fade colour do not change colour at all; as such fade colour must be set after calling this method.- Overrides:
setColorin classnet.minecraft.client.particle.Particle- Parameters:
red- The red color componentgreen- The green color componentblue- The blue colour component
-
setFadeColour
public void setFadeColour(float r, float g, float b) Sets the fade color of the particle.- Parameters:
r- The red color componentg- The green color componentb- The blue colour component
-
setFacing
public void setFacing(float yaw, float pitch) Sets the direction this particle faces. This will cause the particle to render facing the given direction.- Parameters:
yaw- The yaw angle of this particle in degrees, where 0 is south.pitch- The pitch angle of this particle in degrees, where 0 is horizontal.
-
getRenderType
@NotNull public @NotNull net.minecraft.client.particle.ParticleRenderType getRenderType()- Specified by:
getRenderTypein classnet.minecraft.client.particle.Particle
-
getLightColor
protected int getLightColor(float f) - Overrides:
getLightColorin classnet.minecraft.client.particle.Particle
-
render
public void render(@NotNull @NotNull com.mojang.blaze3d.vertex.VertexConsumer vertexConsumer, net.minecraft.client.Camera camera, float tickDelta) - Overrides:
renderin classnet.minecraft.client.particle.SingleQuadParticle
-
drawParticle
protected void drawParticle(com.mojang.blaze3d.vertex.VertexConsumer buffer, net.minecraft.client.Camera camera, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) -
updateEntityLinking
protected void updateEntityLinking(float partialTicks) -
tick
public void tick()- Overrides:
tickin classnet.minecraft.client.particle.Particle
-
move
public void move(double dx, double dy, double dz) - Overrides:
movein classnet.minecraft.client.particle.Particle
-