Package net.neoforged.neoforge.event
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 Summary
-
Constructor Summary
ConstructorDescriptionAddPackFindersEvent
(PackType packType, Consumer<RepositorySource> sources, boolean trusted) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.void
addRepositorySource
(RepositorySource source) Adds a new source to the list of pack finders.boolean
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.
-
Field Details
-
packType
-
sources
-
trusted
private final boolean trusted
-
-
Constructor Details
-
AddPackFindersEvent
-
-
Method Details
-
addRepositorySource
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, andPack.Position.BOTTOM
to add low priority packs.- Parameters:
source
- the pack finder
-
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/` folderpackType
- Whether pack is a resourcepack or datapackpackNameDisplay
- The text that shows for the pack on the pack selection screenpackSource
- 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 themselvespackPosition
- 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
-