public class TextEffect extends YPREffect
  • Field Details

    • text

      public String text
      Text to display.
    • invert

      public boolean invert
      Invert the text, as in it makes it hollowed out of a rectangle background
    • stepX

      public int stepX
      Each stepX pixel will be shown. Saves packets for lower fontsizes.
    • stepY

      public int stepY
      Each stepY pixel will be shown. Saves packets for lower fontsizes.
    • size

      public float size
      Scale the font down
    • realtime

      public boolean realtime
      Set this only to true if you are working with changing text. I'd advise the parser to recalculate the BufferedImage every iteration. Recommended FALSE
    • font

      public Font font
      Font used to create the Text
    • image

      protected BufferedImage image
      Contains an image version of the String
  • Constructor Details

    • TextEffect

      public TextEffect(net.minecraft.server.world.ServerWorld world, net.minecraft.particle.ParticleEffect particle, net.minecraft.util.math.Vec3d originPos, float yaw, float pitch, String text, boolean invert, int stepX, int stepY, float size, boolean realtime, Font font)
      Creates a new TextEffect, displaying a given string with a given Font etc
      Parameters:
      world - The world the particles are going to spawn in
      particle - The particle effect that is going to be spawned. You can use ParticleTypes
      originPos - The origin position of the effect. Aka the center of the sphere
      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()
      text - A string of the text that will be displayed
      invert - Set this true if you want the text to be "hollowed out" of a rectangle display, instead of only shown. Be careful! Way more particles are going to be used in this case!
      stepX - Each stepX pixel will be shown. Saves packets for lower fontsizes. UNRECOMMENDED: May very likely butcher the text if it's not set to 1
      stepY - Each stepX pixel will be shown. Saves packets for lower fontsizes. UNRECOMMENDED: May very likely butcher the text if it's not set to 1
      size - The size of the text to display. Play around with the font size itself too. Usually to get a good quality you would lower the size (this) to some fraction, and increase the font size to around 18
      realtime - Set this to True if you want to update the text that is displayed
      font - The font that will be applied to the displayed Text
  • Method Details

    • copy

      public static void copy(TextEffect original, TextEffect copy)
    • getText

      public String getText()
    • setText

      public void setText(String text)
    • isInvert

      public boolean isInvert()
    • setInvert

      public void setInvert(boolean invert)
    • getStepX

      public int getStepX()
    • setStepX

      public void setStepX(int stepX)
    • getStepY

      public int getStepY()
    • setStepY

      public void setStepY(int stepY)
    • getSize

      public float getSize()
    • setSize

      public void setSize(float size)
    • isRealtime

      public boolean isRealtime()
    • setRealtime

      public void setRealtime(boolean realtime)
    • setFont

      public void setFont(Font font)
    • getFont

      public Font getFont()
    • 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
    • builder

      public static TextEffect.Builder builder(net.minecraft.server.world.ServerWorld world, net.minecraft.particle.ParticleEffect particle, net.minecraft.util.math.Vec3d originPos)
      Returns a builder for the effect.
      Parameters:
      world - The world the particles are going to spawn in
      particle - The particle effect that is going to be spawned. You can use ParticleTypes
      originPos - The origin position of the effect

      Setting a world, a particle effect 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!