Class PetsModAddons

java.lang.Object
com.jeff.pets.client.addon.PetsModAddons

public class PetsModAddons extends Object
The base class for creating Pets Mod addons. Each instance is supposed to represent an addon. Create an instance with registerAddon(String)

Additionally, it has a few internal helper methods for me to manage addons
See Also:
  • Method Details

    • registerAddon

      public static PetsModAddons registerAddon(String id)
      Method used to create and register a new addon. Store it in a static accessible field somewhere so you can access it easily.

      Example Usage

      public static final String MY_MOD_ID = "my_mod_id";
      
      public static final PetsModAddons ADDON = PetsModAddons.registerAddon(MY_MOD_ID);
      
    • forEachAddedPet

      @Internal public static void forEachAddedPet(PetRunnable runnable)
      Internal method
    • forEachAddedPetSafe

      @Internal public static void forEachAddedPetSafe(SafePetRunnable runnable)
      Internal method
    • getIdByEntityType

      @Internal public static String getIdByEntityType(net.minecraft.world.entity.EntityType<?> type)
      Internal method
    • addPet

      public PetsModAddons addPet(@NotNull @NotNull net.minecraft.world.entity.EntityType<? extends AbstractPet> type, @NotNull @NotNull String entityValue, @NotNull @NotNull Field entityName, Optional<PetSkin> skin)
      The standard method to add a pet. Generally you would want to call it in a ClientStartedEvent.

      Example Usage

      *
      
           public static String entityName = ""; //important: MUST BE STATIC
      
           public MyModClass() {
               ADDON.addPet(MyEntityType.MY_PET.get(), "pet", this.getClass().getDeclaredField("entityName"), Optional.empty());
           }
      
           
      Parameters:
      type - The entity type to be used.
      entityValue - What your pet will be referred to in code. Generally just what the pet is called (for example, if your pet is a goose, you would pass "goose" here.)
      entityName - This one is a bit of a doozy, so stay with me - this field needs to be serialized and deserialized into petsconfig.json to avoid forcing developers to serialize their own stuff. Refer to the 'example usage' section for further instructions.
      Returns:
      The instance that you are currently on