Package hm.zelha.particlesfx.shapers
Class ParticleImage
java.lang.Object
hm.zelha.particlesfx.shapers.parents.RotationHandler
hm.zelha.particlesfx.shapers.parents.ParticleShaper
hm.zelha.particlesfx.shapers.ParticleImage
- All Implemented Interfaces:
Shape
This class is generally meant to be used with particles that extend ColorableParticle to properly display a colored image
(
however it allows you to use normal particles to draw detailed objects by reading transparent images
(or by using
(
ParticleDustColored, ParticleEffectColored) however it allows you to use normal particles to draw detailed objects by reading transparent images
(or by using
addIgnoredColor(Color) and setFuzz(int))-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Threadprotected intprotected intprotected intprotected intprotected final List<BufferedImage> protected final ThreadLocalRandomprotected doubleprotected doubleFields inherited from class hm.zelha.particlesfx.shapers.parents.ParticleShaper
animator, async, currentCount, delay, locationHelper, mechanics, overallCount, particle, particleFrequency, particlesPerDisplay, players, secondaryParticles, vectorHelperFields inherited from class hm.zelha.particlesfx.shapers.parents.RotationHandler
centroid, compounds, lastRotatedAround, locations, originalCentroid, origins, rhLocationHelper, rhRotHelper, rhVectorHelper, rot, rot2, rotHelper -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedParticleImage(Particle particle, LocationSafe center, double xRadius, double zRadius, int particleFrequency) ParticleImage(Particle particle, LocationSafe center, File path) ParticleImage(Particle particle, LocationSafe center, File path, double xRadius, double zRadius, int particleFrequency) ParticleImage(Particle particle, LocationSafe center, File path, double radius, int particleFrequency) ParticleImage(Particle particle, LocationSafe center, File path, int particleFrequency) ParticleImage(Particle particle, LocationSafe center, String link) ParticleImage(Particle particle, LocationSafe center, String link, double xRadius, double zRadius, int particleFrequency) ParticleImage(Particle particle, LocationSafe center, String link, double radius, int particleFrequency) ParticleImage(Particle particle, LocationSafe center, String link, int particleFrequency) -
Method Summary
Modifier and TypeMethodDescriptionaddIgnoredColor(Color color) voidadds an image from a file (gifs supported!)voidadds an image from a URL (gifs supported!)voidadds an image from a file (gifs supported!)voidadds an image from a URL (gifs supported!)protected voidaddOrRemoveImages(Object toLoad, boolean remove, int index) clone()using this method will cause the current thread to stall until any currently running image production is finished.protected ParticleShapervoiddisplay()org.bukkit.Locationintusing this method will cause the current thread to stall until any currently running image production is finished.intintgetFuzz()getIgnoredColor(int index) intgetPixelColor(int index, int x, int z) using this method will cause the current thread to stall until any currently running image production is finished.doubledoublevoidremoveFrame(int index) using this method will cause the current thread to stall until any currently running image production is finished.voidremoveIgnoredColor(int index) voidremoveImage(File path) gets an image from a file and removes it (gifs supported!)voidremoveImage(String link) gets an image from a URL and removes it (gifs supported!)voidscale(double x, double y, double z) Rescales this shape such that a shape with the xyz radiuses of 4, 3, 4, resized by 1.25, 1.25, 1.25, would have its radiuses become 5, 3.75, 5.voidsetCenter(LocationSafe center) voidsetCurrentFrame(int index) using this method will cause the current thread to stall until any currently running image production is finished.setFrameDelay(int frameDelay) setFuzz(int fuzz) setRadius(double radius) using this method will cause the current thread to stall until any currently running image production is finished.voidsetXRadius(double xRadius) voidsetZRadius(double zRadius) Methods inherited from class hm.zelha.particlesfx.shapers.parents.ParticleShaper
addMechanic, addParticle, addPlayer, addPlayer, applyMechanics, getCurrentParticle, getDelay, getMechanicAmount, getParticle, getParticleFrequency, getParticlesPerDisplay, getPlayerAmount, getPlayers, getSecondaryParticle, getSecondaryParticleAmount, hasPlayer, isAsync, isRunning, removeMechanic, removeParticle, removePlayer, removePlayer, setAsync, setDelay, setDisplayPosition, setParticle, setParticleFrequency, setParticlesPerDisplay, setWorld, start, stopMethods inherited from class hm.zelha.particlesfx.shapers.parents.RotationHandler
addCompound, calculateCentroid, face, faceAroundLocation, getAroundAxisPitch, getAroundAxisRoll, getAroundAxisYaw, getAroundPitch, getAroundRoll, getAroundRotationOrder, getAroundYaw, getAxisPitch, getAxisRoll, getAxisYaw, getClonedCenter, getDirection, getLocationAmount, getLocations, getLocationsList, getPitch, getRoll, getRotationOrder, getTotalDistance, getWorld, getYaw, move, move, move, recalculateIfNeeded, removeCompound, rotate, rotateAroundLocation, scale, setAroundAxisPitch, setAroundAxisRoll, setAroundAxisRotation, setAroundAxisYaw, setAroundPitch, setAroundRoll, setAroundRotation, setAroundRotationOrder, setAroundYaw, setAxisPitch, setAxisRoll, setAxisRotation, setAxisYaw, setPitch, setRoll, setRotation, setRotationOrder, setYawMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hm.zelha.particlesfx.shapers.parents.Shape
face, faceAroundLocation, getAroundAxisPitch, getAroundAxisRoll, getAroundAxisYaw, getAroundPitch, getAroundRoll, getAroundRotationOrder, getAroundYaw, getAxisPitch, getAxisRoll, getAxisYaw, getClonedCenter, getLocationAmount, getLocations, getPitch, getRoll, getRotationOrder, getTotalDistance, getWorld, getYaw, move, move, move, rotate, rotateAroundLocation, scale, setAroundAxisPitch, setAroundAxisRoll, setAroundAxisRotation, setAroundAxisYaw, setAroundPitch, setAroundRoll, setAroundRotation, setAroundRotationOrder, setAroundYaw, setAxisPitch, setAxisRoll, setAxisRotation, setAxisYaw, setPitch, setRoll, setRotation, setRotationOrder, setYaw
-
Field Details
-
rng
-
images
-
ignoredColors
-
xRadius
protected double xRadius -
zRadius
protected double zRadius -
fuzz
protected int fuzz -
frameDelay
protected int frameDelay -
frame
protected int frame -
displaysThisFrame
protected int displaysThisFrame -
currentThread
-
-
Constructor Details
-
ParticleImage
public ParticleImage(Particle particle, LocationSafe center, String link, double xRadius, double zRadius, int particleFrequency) - See Also:
-
ParticleImage
public ParticleImage(Particle particle, LocationSafe center, File path, double xRadius, double zRadius, int particleFrequency) - See Also:
-
ParticleImage
public ParticleImage(Particle particle, LocationSafe center, String link, double radius, int particleFrequency) - See Also:
-
ParticleImage
public ParticleImage(Particle particle, LocationSafe center, File path, double radius, int particleFrequency) - See Also:
-
ParticleImage
- See Also:
-
ParticleImage
- See Also:
-
ParticleImage
- See Also:
-
ParticleImage
- See Also:
-
ParticleImage
protected ParticleImage(Particle particle, LocationSafe center, double xRadius, double zRadius, int particleFrequency)
-
-
Method Details
-
display
public void display()- Specified by:
displayin interfaceShape- Specified by:
displayin classParticleShaper
-
clone
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Specified by:
clonein interfaceShape- Overrides:
clonein classParticleShaper
-
cloneConstructor
- Specified by:
cloneConstructorin classParticleShaper
-
scale
public void scale(double x, double y, double z) Description copied from interface:ShapeRescales this shape such that a shape with the xyz radiuses of 4, 3, 4, resized by 1.25, 1.25, 1.25, would have its radiuses become 5, 3.75, 5.- Specified by:
scalein interfaceShape- Overrides:
scalein classRotationHandler- Parameters:
x- x scaley- y scalez- z scale
-
addOrRemoveImages
-
addImage
adds an image from a URL (gifs supported!)
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
index- index to put the imagelink- URL of image
-
addImage
adds an image from a file (gifs supported!)
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
index- index to put the imagepath- location of file
-
addImage
adds an image from a URL (gifs supported!)
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
link- URL of image
-
addImage
adds an image from a file (gifs supported!)
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
path- location of file
-
addIgnoredColor
-
removeImage
gets an image from a URL and removes it (gifs supported!)
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
link- URL of image
-
removeImage
gets an image from a file and removes it (gifs supported!)
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
path- location of file
-
removeFrame
public void removeFrame(int index) using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
index- index of frame you want to remove from the frame list
-
removeIgnoredColor
public void removeIgnoredColor(int index) -
setCurrentFrame
public void setCurrentFrame(int index) using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
index- index of frame you want to be displaying
-
setCenter
-
setRadius
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!
This method uses the current image's aspect ratio to set the X/Z radius, such that the largest side is set to the given radius and the smallest side is set to (smallest / largest) * radius.- Parameters:
radius- max radius
-
setXRadius
public void setXRadius(double xRadius) -
setZRadius
public void setZRadius(double zRadius) -
setFuzz
- Parameters:
fuzz- how similar pixel colors have to be to ignored colors in order to be ignored
-
setFrameDelay
- Parameters:
frameDelay- amount of times to display before switching to the next frame
-
getPixelColor
using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Parameters:
index- frame to get the color fromx- horizontal position of pixelz- vertical position of pixel- Returns:
- color at pixel
-
getCenter
public org.bukkit.Location getCenter() -
getXRadius
public double getXRadius() -
getZRadius
public double getZRadius() -
getFuzz
public int getFuzz()- Returns:
- how similar pixel colors have to be to ignored colors in order to be ignored
-
getFrameDelay
public int getFrameDelay()- Returns:
- amount of times to display before switching to the next frame
-
getIgnoredColor
-
getIgnoredColorAmount
public int getIgnoredColorAmount() -
getFrameAmount
public int getFrameAmount()using this method will cause the current thread to stall until any currently running image production is finished.
If you don't want to cause lag, use an asynchronous BukkitRunnable!- Returns:
- amount of images stored
-