java.lang.Object
com.pixelmonmod.pixelmon.api.pokemon.item.pokeball.PokeBall
All Implemented Interfaces:
ITranslatable

public class PokeBall extends Object implements ITranslatable
Class representing the look and mechanics of a Poké Ball. Synced to client via datapacks.
  • Constructor Details

    • PokeBall

      public PokeBall(String name, String model, ResourceWithFallback texture, ResourceWithFallback flashingTexture, ResourceWithFallback ballSprite, ResourceWithFallback lidSprite, ResourceWithFallback guiSprite, String logic, String[] bases, String captureMethod, double catchBonus, double breakChance, double velocityModifier, double gravityModifier, boolean particles, boolean hasLid, net.minecraft.world.item.Rarity rarity, String json)
      Constructs a new Poké Ball. Generally, this should only be called by the loading of a datapack containing Poké Ball jsons, but they can be constructed manually if so desired.
      Parameters:
      name - The unique name of this Poké Ball.
      model - The path to the model of this Poké Ball.
      texture - The path to the texture for the model of this Poké Ball.
      flashingTexture - The path to the texture for the model of the Poké Ball while it is flashing.
      ballSprite - The path to the sprite of the Poké Ball item of this Poké Ball.
      lidSprite - The path to the sprite of the Poké Ball Lid item of this Poké Ball.
      guiSprite - The path to the texture for the party sidebar visual of this Poké Ball.
      logic - The classpath of the BallLogic class of this Poké Ball. Null or empty means no special logic.
      bases - Item IDs of what bases this Poké Ball uses.
      captureMethod - The registered CaptureMethod to use for this Poké Ball.
      catchBonus - The base ball bonus of this Poké Ball.
      breakChance - The chance, 0-1, that this Poké Ball breaks on a miss.
      velocityModifier - The multiplier by which this Poké Ball's thrown velocity is multiplied by.
      gravityModifier - The multiplier by which this Poké Ball's gravity acceleration is multiplied by.
      particles - Whether this Poké Ball has a rainbow particle trail or not.
      json - The JSON representation of this Poké Ball object.
  • Method Details

    • getName

      public String getName()
      Gets the name of this Poké Ball.
      Returns:
      This Poké Ball's name.
    • getModel

      public String getModel()
      Gets the model type of this Poké Ball.
      Returns:
      This Poké Ball's model type.
    • getBallSprite

      public net.minecraft.resources.ResourceLocation getBallSprite()
      Gets the sprite ResourceLocation of this Poké Ball.
      Returns:
      This Poké Ball's sprite ResourceLocation.
    • getLidSprite

      public net.minecraft.resources.ResourceLocation getLidSprite()
      Gets the sprite ResourceLocation of this Poké Ball Lid.
      Returns:
      This Poké Ball Lid's sprite ResourceLocation.
    • getModelTexture

      public net.minecraft.resources.ResourceLocation getModelTexture()
      Gets the texture ResourceLocation of this Poké Ball.
      Returns:
      This Poké Ball's texture ResourceLocation.
    • getFlashingTexture

      public net.minecraft.resources.ResourceLocation getFlashingTexture()
      Gets the flashing texture ResourceLocation of this Poké Ball.
      Returns:
      This Poké Ball's flashing texture ResourceLocation.
    • getGUISprite

      public net.minecraft.resources.ResourceLocation getGUISprite()
      Gets the GUI sprite ResourceLocation of this Poké Ball.
      Returns:
      This Poké Ball's GUI sprite ResourceLocation.
    • getLogic

      public BallLogic getLogic()
      Gets the capture logic for this Poké Ball.
      Returns:
      This Poké Ball's capture logic.
    • getBases

      public String[] getBases()
      Gets the possible bases for this Poké Ball.
      Returns:
      This Poké Ball's bases.
    • getCaptureMethod

      public CaptureMethod getCaptureMethod()
      Gets the capture method used by this Poké Ball.
      Returns:
      The Poké Ball's capture method.
    • getCatchBonus

      public double getCatchBonus()
      Gets the catch bonus of this Poké Ball.
      Returns:
      This Poké Ball's catch bonus.
    • isGuaranteedCatch

      public boolean isGuaranteedCatch()
      Gets whether this Poké Ball is a guaranteed catch or not.
      Returns:
      Whether this Poké Ball is a guaranteed catch.
    • getBreakChance

      public double getBreakChance()
      Gets the break chance of this Poké Ball.
      Returns:
      This Poké Ball's break chance.
    • getVelocityModifier

      public double getVelocityModifier()
      Gets the velocity modifier of this Poké Ball.
      Returns:
      This Poké Ball's velocity modifier.
    • getGravityModifier

      public double getGravityModifier()
      Gets the gravity modifier of this Poké Ball.
      Returns:
      This Poké Ball's gravity modifier.
    • hasParticles

      public boolean hasParticles()
      Gets whether this Poké Ball has a special particle trail.
      Returns:
      If this Poké Ball has a particle trail.
    • getTranslationKey

      public String getTranslationKey()
      Gets the translation key of this Poké Ball's Poké Ball item name.
      Specified by:
      getTranslationKey in interface ITranslatable
      Returns:
      Poké Ball item name's translation key.
    • getLidTranslationKey

      public String getLidTranslationKey()
      Gets the translation key of this Poké Ball's Poké Ball Lid item name.
      Returns:
      Poké Ball Lid item name's translation key.
    • hasLid

      public boolean hasLid()
      If the ball has a lid item
      Returns:
      If it has a lid item
    • getTranslatedLidName

      public net.minecraft.network.chat.Component getTranslatedLidName()
      Gets the translated name of this Poké Ball's Poké Ball Lid item name.
      Returns:
      Poké Ball Lid item name's translated name.
    • is

      public boolean is(PokeBall... pokeballs)
      Checks if any of the balls in the given array match the current one
      Parameters:
      pokeballs - The balls being checked
      Returns:
      True if a match is found
    • is

      @SafeVarargs public final boolean is(RegistryValue<PokeBall>... pokeballs)
      Checks if any of the balls in the given array match the current one
      Parameters:
      pokeballs - The balls being checked
      Returns:
      True if a match is found
    • getModelHolder

      public GenericModelHolder<ModelPokeballs> getModelHolder()
      Gets a ModelPokeballs instance for the given PokeBall
      Returns:
      The model pokeballs
    • getModelHolder

      public GenericModelHolder<ModelPokeballs> getModelHolder(boolean animate)
      Gets a ModelPokeballs instance for the given PokeBall
      Returns:
      The model pokeballs
    • getBallItem

      public net.minecraft.world.item.ItemStack getBallItem()
      Gets a new ItemStack of count 1 of this Poké Ball.
      Returns:
      A new ItemStack of count 1 of this Poké Ball.
    • getBallItem

      public net.minecraft.world.item.ItemStack getBallItem(int count)
      Gets a new ItemStack of this Poké Ball.
      Parameters:
      count - The size of the new ItemStack.
      Returns:
      A new ItemStack of this Poké Ball.
    • getBasesAsItems

      public Set<net.minecraft.world.item.Item> getBasesAsItems()
      Gets a Set of the Poké Ball bases this Poké Ball can have.
      Returns:
      Set of base Items.
    • getRandomBaseAsItem

      public net.minecraft.world.item.Item getRandomBaseAsItem()
      Gets a random Poké Ball base this Poké Ball can have.
      Returns:
      Random base Item.
    • getLidItem

      public net.minecraft.world.item.ItemStack getLidItem()
      Gets a new ItemStack of count 1 of this Poké Ball's lid.
      Returns:
      A new ItemStack of count 1 of this Poké Ball's lid.
    • getLidItem

      public net.minecraft.world.item.ItemStack getLidItem(int count)
      Gets a new ItemStack of this Poké Ball's lid.
      Parameters:
      count - The size of the new ItemStack.
      Returns:
      A new ItemStack of this Poké Ball's lid.
    • getJson

      public String getJson()
      Gets this Poké Ball object's JSON representation as a String, if available.
      Returns:
      This Poké Ball's JSON representation.
    • getLogicPath

      public String getLogicPath()
      Gets the classpath of the BallLogic of this Poké Ball. May be null or empty for no logic.
      Returns:
      This Poké Ball's logic classpath.
    • getCaptureMethodID

      public String getCaptureMethodID()
      Gets the ID of the CaptureMethod of this Poké Ball.
      Returns:
      This Poké Ball's capture method ID.
    • isHisuian

      public boolean isHisuian()
      Checks if the PokeBall is a Hisuian (ancient) ball
      Returns:
      If the ball is from the hisui region
    • getRarity

      public net.minecraft.world.item.Rarity getRarity()
      The item rarity of the ball
      Returns:
      The rarity of the ball
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object