public class ImageEffect extends YPREffect
  • Field Details

    • fileName

      public String fileName
      For configuration-driven files
    • transparency

      public boolean transparency
      Whether or not to check for transparent pixels
    • frameDelay

      public int frameDelay
      How many ticks to show each frame
    • stepX

      public int stepX
      Each stepX pixel will be shown. Saves packets for high resolutions.
    • stepY

      public int stepY
      Each stepY pixel will be shown. Saves packets for high resolutions.
    • scale

      public float scale
      Scale the image down
    • particleSize

      public float particleSize
      How big should the dust particles be?
    • enableRotation

      public boolean enableRotation
      Should it rotate?
    • rotation

      public net.minecraft.util.math.Vec3d rotation
      Apply a fixed rotation
    • orient

      public boolean orient
      Orients the image to the specified Yaw Pitch, for example facing a player
    • plane

      public ImageEffect.Plane plane
      What plane should it rotate?
    • angularVelocityX

      public double angularVelocityX
      Turns the image by this angle each iteration around the x-axis
    • angularVelocityY

      public double angularVelocityY
      Turns the image by this angle each iteration around the y-axis
    • angularVelocityZ

      public double angularVelocityZ
      Turns the image by this angle each iteration around the z-axis
    • blackAndWhite

      public boolean blackAndWhite
      Weather or not this should display as black and white
    • invertColors

      public boolean invertColors
      Weather or not the color of the image should be inverted
    • images

      protected BufferedImage[] images
      Image as BufferedImage
    • step

      protected int step
      Step counter
    • rotationStepCounter

      protected int rotationStepCounter
      Rotation step counter
    • stepDelay

      protected int stepDelay
      Delay between steps
    • imageLoadCallback

      protected ImageLoadCallback imageLoadCallback
    • ERROR_IMAGE

      public static final String ERROR_IMAGE
      See Also:
  • Constructor Details

    • ImageEffect

      public ImageEffect(net.minecraft.server.world.ServerWorld world, net.minecraft.util.math.Vec3d origin, float yaw, float pitch, String fileName, boolean transparency, int frameDelay, int stepX, int stepY, float scale, float particleSize, net.minecraft.util.math.Vec3d rotation, boolean orient, boolean enableRotation, ImageEffect.Plane plane, double angularVelocityX, double angularVelocityY, double angularVelocityZ, boolean blackAndWhite, boolean invertColors)
      Creates a new ImageEffect. By default, it is coloured, but you can set it to be black and white (which were the best gen pokèmon games btw)
      Parameters:
      world - The world the particles are going to spawn in
      origin - The origin position of the effect, aka the starting point of the cone
      yaw - The yaw of the effect. For example, you can get it from an Entity using getYaw()
      pitch - The pitch of the effect. For example, you can get it from an Entity using getPitch()
      fileName - The path and the name of the file that you want to display. It can also be an URL. Supported formats include jpg, png, gif
      transparency - If true transparent pixels will be transparent, otherwise they will be black.
      frameDelay - How many ticks to show each frame for
      stepX - How many pixel should be skipped on the X? Aka show only one pixel every *n* on the X plane
      stepY - How many pixel should be skipped on the Y? Aka show only one pixel every *n* on the Y plane
      scale - Scale factor for the image
      particleSize - How big should each individual Dust particle be? See also DustParticleEffect
      rotation - Apply a fixed rotation (independent of enableRotation)
      orient - Should the image orient towards yaw and pitch? For example orient to the player's facing direction
      enableRotation - Should it rotate?
      plane - What plane should it rotate?
      angularVelocityX - Turns the image by this angle each iteration around the x-axis (radians)
      angularVelocityY - Turns the image by this angle each iteration around the y-axis (radians)
      angularVelocityZ - Turns the image by this angle each iteration around the z-axis (radians)
      blackAndWhite - Makes the image display in binary colors, black and white
      invertColors - Inverts the color of the image, displaying its negative
  • Method Details

    • copy

      public static void copy(ImageEffect original, ImageEffect copy)
    • builder

      public static ImageEffect.Builder builder(net.minecraft.server.world.ServerWorld world, net.minecraft.util.math.Vec3d originPos, String fileName)
      Returns a builder for the effect.
      Parameters:
      world - The world the particles are going to spawn in
      originPos - The origin position of the effect

      Setting a world, an image path and an origin position is ALWAYS mandatory, hence their presence in this method! If this is an effect that uses Yaw and Pitch, remember to set those as well!

      fileName - The path and the name of the file that you want to display. It can also be an URL. * You can also use new Identifier(modid, resource).getPath(). Supported formats include jpg, png, gif
    • builder

      public static ImageEffect.Builder builder(net.minecraft.server.world.ServerWorld world, net.minecraft.util.math.Vec3d originPos, net.minecraft.util.Identifier image)
      Returns a builder for the effect.
      Parameters:
      world - The world the particles are going to spawn in
      originPos - The origin position of the effect

      Setting a world, an image path and an origin position is ALWAYS mandatory, hence their presence in this method! If this is an effect that uses Yaw and Pitch, remember to set those as well!

      image - An identifier representing the image that will be displayed. The image must be placed in the /data/ folder and not the /assets/ folder!
    • load

      public void load(String fileName)
      Automatically called when creating a new ImageEffect using a string path Can be used to update the image that is displayed. WARNING! Maye cause issues
    • load

      public void load(net.minecraft.util.Identifier fileName)
      Automatically called when creating a new ImageEffect using an Identifier path Can be used to update the image that is displayed. WARNING! Maye cause issues
    • onRun

      public void onRun()
      Description copied from class: Effect
      Main method to extend, here the animation code is run EACH tick
      Overrides:
      onRun in class Effect
    • getFileName

      public String getFileName()
    • setFileName

      public void setFileName(String fileName)
      It will also update the loaded image!
    • setFileId

      public void setFileId(net.minecraft.util.Identifier fileId)
      It will also update the loaded image!
    • isTransparency

      public boolean isTransparency()
    • setTransparency

      public void setTransparency(boolean transparency)
    • getFrameDelay

      public int getFrameDelay()
    • setFrameDelay

      public void setFrameDelay(int frameDelay)
    • getStepX

      public int getStepX()
    • setStepX

      public void setStepX(int stepX)
    • getStepY

      public int getStepY()
    • setStepY

      public void setStepY(int stepY)
    • getScale

      public float getScale()
    • setScale

      public void setScale(float scale)
    • getParticleSize

      public float getParticleSize()
    • setParticleSize

      public void setParticleSize(float particleSize)
    • isEnableRotation

      public boolean isEnableRotation()
    • setEnableRotation

      public void setEnableRotation(boolean enableRotation)
    • getRotation

      public net.minecraft.util.math.Vec3d getRotation()
    • setRotation

      public void setRotation(net.minecraft.util.math.Vec3d rotation)
    • isOrient

      public boolean isOrient()
    • setOrient

      public void setOrient(boolean orient)
    • getPlane

      public ImageEffect.Plane getPlane()
    • setPlane

      public void setPlane(ImageEffect.Plane plane)
    • getAngularVelocityX

      public double getAngularVelocityX()
    • setAngularVelocityX

      public void setAngularVelocityX(double angularVelocityX)
    • getAngularVelocityY

      public double getAngularVelocityY()
    • setAngularVelocityY

      public void setAngularVelocityY(double angularVelocityY)
    • getAngularVelocityZ

      public double getAngularVelocityZ()
    • setAngularVelocityZ

      public void setAngularVelocityZ(double angularVelocityZ)
    • isBlackAndWhite

      public boolean isBlackAndWhite()
    • setBlackAndWhite

      public void setBlackAndWhite(boolean blackAndWhite)
    • isInvertColors

      public boolean isInvertColors()
    • setInvertColors

      public void setInvertColors(boolean invert_colors)
    • display

      protected void display(BufferedImage image, net.minecraft.util.math.Vec3d v, net.minecraft.util.math.Vec3d pos, int pixel_color)
      This methods handles the display of the image into particle form