Package noppes.npcs.api
Interface IParticle
-
public interface IParticle
A particle that can be spawned in the world, complete with translation, scale, rotate, and color transformations. (CNPC+ original!) To create a particle object: API.createParticle(directory); Then modify its attributes as you please, and call the particle's spawn functions to see it in the world. Spawning this particle in the world sends a hefty packet with all its data to the client. The particle is then rendered with a custom renderer based on all the given attributes. If a particle appears to not appear at first, try increasing its scale or changing its position. The entity it's being spawned on or a block in the world may be blocking it.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description float
getAlpha1()
float
getAlpha2()
float
getAlphaRate()
int
getAlphaRateStart()
int
getAmount()
int
getAnimEnd()
boolean
getAnimLoop()
int
getAnimRate()
int
getAnimStart()
java.lang.String
getDirectory()
boolean
getFacePlayer()
boolean
getGlows()
float
getGravity()
int
getHeight()
int
getHEXColor1()
int
getHEXColor2()
float
getHEXColorRate()
int
getHEXColorStart()
int
getMaxAge()
double
getMotionX()
double
getMotionY()
double
getMotionZ()
boolean
getNoClip()
int
getOffsetX()
int
getOffsetY()
void
getPos()
float
getRotationX1()
float
getRotationX2()
float
getRotationXRate()
int
getRotationXRateStart()
float
getRotationY1()
float
getRotationY2()
float
getRotationYRate()
int
getRotationYRateStart()
float
getRotationZ1()
float
getRotationZ2()
float
getRotationZRate()
int
getRotationZRateStart()
float
getScaleX1()
float
getScaleX2()
float
getScaleXRate()
int
getScaleXRateStart()
float
getScaleY1()
float
getScaleY2()
float
getScaleYRate()
int
getScaleYRateStart()
int
getWidth()
double
getX()
double
getY()
double
getZ()
void
setAlpha(float alpha1, float alpha2, float alphaRate, int alphaRateStart)
void
setAmount(int amount)
void
setAnim(int animRate, boolean animLoop, int animStart, int animEnd)
Enables animation on the particle.void
setDirectory(java.lang.String directory)
void
setFacePlayer(boolean facePlayer)
void
setGlows(boolean glows)
void
setHEXColor(int HEXColor, int HEXColor2, float HEXColorRate, int HEXColorStart)
void
setMaxAge(int maxAge)
void
setMotion(double motionX, double motionY, double motionZ, float gravity)
void
setNoClip(boolean noClip)
void
setOffset(int offsetX, int offsetY)
The horizontal and vertical offset of the particle's texture from the top-left, starts rendering the particle at this point.void
setPosition(double x, double y, double z)
void
setPosition(IPos pos)
void
setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart)
Enables rotation about the X axis.void
setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart)
Enables rotation about the Y axis.void
setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart)
Enables rotation about the Y axis.void
setScale(float scale1, float scale2, float scaleRate, int scaleRateStart)
void
setScaleX(float scale1, float scale2, float scaleRate, int scaleRateStart)
void
setScaleY(float scale1, float scale2, float scaleRate, int scaleRateStart)
void
setSize(int width, int height)
The width and height of the particle's texture you want to render in pixels.void
spawn(IEntity entity)
void
spawn(IWorld world)
void
spawn(IWorld world, double x, double y, double z)
void
spawnInWorld(IWorld world)
Deprecated.void
spawnInWorld(IWorld world, double x, double y, double z)
Deprecated.void
spawnOnEntity(IEntity entity)
Deprecated.
-
-
-
Method Detail
-
spawn
void spawn(IEntity entity)
- Parameters:
entity
- Spawns this particle object on the given entity. When spawned this way, the particle will always have its origin at the entity.
-
spawn
void spawn(IWorld world)
- Parameters:
world
- Spawns the particle in the given world, at a position corresponding to this particle's position variables.
-
spawn
void spawn(IWorld world, double x, double y, double z)
- Parameters:
world
- Spawns the particle in the given world, at a position determined by the input parameters.x
- The X position the particle will spawn in the world.y
- The Y position the particle will spawn in the world.z
- The Z position the particle will spawn in the world.
-
spawnOnEntity
@Deprecated void spawnOnEntity(IEntity entity)
Deprecated.
-
spawnInWorld
@Deprecated void spawnInWorld(IWorld world)
Deprecated.
-
spawnInWorld
@Deprecated void spawnInWorld(IWorld world, double x, double y, double z)
Deprecated.
-
setGlows
void setGlows(boolean glows)
- Parameters:
glows
- If true, this particle ignores all lighting and always renders with full brightness.
-
getGlows
boolean getGlows()
-
setNoClip
void setNoClip(boolean noClip)
-
getNoClip
boolean getNoClip()
-
setFacePlayer
void setFacePlayer(boolean facePlayer)
- Parameters:
facePlayer
- Whether the particle is always facing the player's camera. If this is disabled, the particle will appear to be laying flat face down on the ground if its rotation is unchanged.
-
getFacePlayer
boolean getFacePlayer()
-
setDirectory
void setDirectory(java.lang.String directory)
- Parameters:
directory
- The directory of this particle's texture. This can be any texture in a resource pack or mod, and even a URL!
-
getDirectory
java.lang.String getDirectory()
-
setAmount
void setAmount(int amount)
- Parameters:
amount
- The amount of multiples of this particle to spawn in the world. Not too good looking if used, but has some edge cases where it's alright.
-
getAmount
int getAmount()
-
setMaxAge
void setMaxAge(int maxAge)
- Parameters:
maxAge
- The maximum age this particle will be around for, in MC ticks.
-
getMaxAge
int getMaxAge()
-
setSize
void setSize(int width, int height)
The width and height of the particle's texture you want to render in pixels. Anything more gets cut off.- Parameters:
width
- The width of the particle's texture, in pixels.height
- The height of the particle's texture, in pixels.
-
getWidth
int getWidth()
-
getHeight
int getHeight()
-
setOffset
void setOffset(int offsetX, int offsetY)
The horizontal and vertical offset of the particle's texture from the top-left, starts rendering the particle at this point.- Parameters:
offsetX
- The horizontal offset, in pixels (u).offsetY
- The vertical offset, in pixels (v).
-
getOffsetX
int getOffsetX()
-
getOffsetY
int getOffsetY()
-
setAnim
void setAnim(int animRate, boolean animLoop, int animStart, int animEnd)
Enables animation on the particle. Must set a custom width and height first using the setSize(width,height) function. Every frame of animation the particle goes through should be saved on a single image file. The renderer will read the frames of animation based on the given width and height of the particle, starting from the given X & Y offsets. The renderer then goes rightwards (width) pixels for every frame. Once it can't go rightwards anymore, the animation goes down (height) pixels, and once again keeps going rightwards if it has to. If the animation loops, once there is nowhere downward to go, the animation will start over at the X & Y offset.- Parameters:
animRate
- The frame rate of the particle's animation, in MC ticks. (20 ticks = 1 second)animLoop
- Whether the animation loops or not.animStart
- The amount of ticks before the particle starts animating.animEnd
- The amount of ticks the particle is around for before it stops animating.
-
getAnimRate
int getAnimRate()
-
getAnimLoop
boolean getAnimLoop()
-
getAnimStart
int getAnimStart()
-
getAnimEnd
int getAnimEnd()
-
setPosition
void setPosition(double x, double y, double z)
- Parameters:
x
- The X position from the particle's origin the particle will spawn at.y
- The Y position from the particle's origin the particle will spawn at.z
- The Z position from the particle's origin the particle will spawn at.
-
getX
double getX()
-
getY
double getY()
-
getZ
double getZ()
-
setPosition
void setPosition(IPos pos)
-
getPos
void getPos()
-
setMotion
void setMotion(double motionX, double motionY, double motionZ, float gravity)
-
getMotionX
double getMotionX()
-
getMotionY
double getMotionY()
-
getMotionZ
double getMotionZ()
-
getGravity
float getGravity()
-
setHEXColor
void setHEXColor(int HEXColor, int HEXColor2, float HEXColorRate, int HEXColorStart)
- Parameters:
HEXColor
- The starting HEX color of the particle.HEXColor2
- The ending HEX color of the particle.HEXColorRate
- The rate of interpolation between the two HEX colors.HEXColorStart
- The amount of ticks the particle is around for before its colors begin interpolating between HEXColor and HEXColor2.
-
getHEXColor1
int getHEXColor1()
-
getHEXColor2
int getHEXColor2()
-
getHEXColorRate
float getHEXColorRate()
-
getHEXColorStart
int getHEXColorStart()
-
setAlpha
void setAlpha(float alpha1, float alpha2, float alphaRate, int alphaRateStart)
- Parameters:
alpha1
- The starting transparency of the particle.alpha2
- The ending transparency of the particle.alphaRate
- The rate of interpolation between the two transparency values.alphaRateStart
- The amount of ticks the particle is around for before its colors begin interpolating between alpha1 and alpha2.
-
getAlpha1
float getAlpha1()
-
getAlpha2
float getAlpha2()
-
getAlphaRate
float getAlphaRate()
-
getAlphaRateStart
int getAlphaRateStart()
-
setScale
void setScale(float scale1, float scale2, float scaleRate, int scaleRateStart)
- Parameters:
scale1
- The starting scale/size of the particle.scale2
- The ending scale/size of the particle.scaleRate
- The rate of interpolation between the two scale values.scaleRateStart
- The amount of ticks the particle is around for before its colors begin interpolating between scale1 and scale2.
-
setScaleX
void setScaleX(float scale1, float scale2, float scaleRate, int scaleRateStart)
-
getScaleX1
float getScaleX1()
-
getScaleX2
float getScaleX2()
-
getScaleXRate
float getScaleXRate()
-
getScaleXRateStart
int getScaleXRateStart()
-
setScaleY
void setScaleY(float scale1, float scale2, float scaleRate, int scaleRateStart)
-
getScaleY1
float getScaleY1()
-
getScaleY2
float getScaleY2()
-
getScaleYRate
float getScaleYRate()
-
getScaleYRateStart
int getScaleYRateStart()
-
setRotationX
void setRotationX(float rotationX1, float rotationX2, float rotationXRate, int rotationXRateStart)
Enables rotation about the X axis. If the particle is set to always face the player, this axis is a constant horizontal line on the player's camera.- Parameters:
rotationX1
- The starting X rotation of the particle.rotationX2
- The ending X rotation of the particle.rotationXRate
- The rate of interpolation between the two X rotation values.rotationXRateStart
- The amount of ticks the particle is around for before its colors begin interpolating between rotationX1 and rotationX2.
-
getRotationX1
float getRotationX1()
-
getRotationX2
float getRotationX2()
-
getRotationXRate
float getRotationXRate()
-
getRotationXRateStart
int getRotationXRateStart()
-
setRotationY
void setRotationY(float rotationY1, float rotationY2, float rotationYRate, int rotationYRateStart)
Enables rotation about the Y axis. If the particle is set to always face the player, this axis is a constant vertical line on the player's camera.- Parameters:
rotationY1
- The starting Y rotation of the particle.rotationY2
- The ending Y rotation of the particle.rotationYRate
- The rate of interpolation between the two Y rotation values.rotationYRateStart
- The amount of ticks the particle is around for before its colors begin interpolating between rotationY1 and rotationY2.
-
getRotationY1
float getRotationY1()
-
getRotationY2
float getRotationY2()
-
getRotationYRate
float getRotationYRate()
-
getRotationYRateStart
int getRotationYRateStart()
-
setRotationZ
void setRotationZ(float rotationZ1, float rotationZ2, float rotationZRate, int rotationZRateStart)
Enables rotation about the Y axis. If the particle is set to always face the player, this axis is a constant line going into the player's camera. You'll be using this one most often if the particle is set to face the player.- Parameters:
rotationZ1
- The starting Z rotation of the particle.rotationZ2
- The ending Z rotation of the particle.rotationZRate
- The rate of interpolation between the two Z rotation values.rotationZRateStart
- The amount of ticks the particle is around for before its colors begin interpolating between rotationZ1 and rotationZ2.
-
getRotationZ1
float getRotationZ1()
-
getRotationZ2
float getRotationZ2()
-
getRotationZRate
float getRotationZRate()
-
getRotationZRateStart
int getRotationZRateStart()
-
-