Class AddPackFindersEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.AddPackFindersEvent
All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent

public class AddPackFindersEvent extends net.neoforged.bus.api.Event implements net.neoforged.fml.event.IModBusEvent
Fired on PackRepository creation to allow mods to add new pack finders.
  • Field Details

  • Constructor Details

  • Method Details

    • addRepositorySource

      public void addRepositorySource(RepositorySource source)
      Adds a new source to the list of pack finders.

      Sources are processed in the order that they are added to the event. Use Pack.Position.TOP to add high priority packs, and Pack.Position.BOTTOM to add low priority packs.

      Parameters:
      source - the pack finder
    • getPackType

      public PackType getPackType()
      Returns:
      the PackType of the pack repository being constructed.
    • addPackFinders

      public void addPackFinders(ResourceLocation packLocation, PackType packType, Component packNameDisplay, PackSource packSource, boolean alwaysActive, Pack.Position packPosition)
      Helper method to register a pack found under the `resources/` folder.
      Parameters:
      packLocation - Location of the pack to load. Namespace should be the modid of the pack owner and path is the location under `resources/` folder
      packType - Whether pack is a resourcepack or datapack
      packNameDisplay - The text that shows for the pack on the pack selection screen
      packSource - Controls whether the datapack is enabled or disabled by default. Resourcepacks are always disabled by default unless you set alwaysActive to true.
      alwaysActive - Whether the pack is forced active always. If false, players have to manually activate the pack themselves
      packPosition - Where the pack goes for determining pack applying order
    • isTrusted

      public boolean isTrusted()
      Returns whether or not the pack repository being assembled is the one used to provide known packs to the client to avoid syncing from the server.
      Returns:
      whether or not the pack repository being assembled is the one used to provide known packs to the client to avoid syncing from the server