Class BundleManager
java.lang.Object
de.luckymcdev.foundryengine.common.bundle.BundleManager
- All Implemented Interfaces:
net.minecraft.server.packs.resources.PreparableReloadListener, net.minecraft.server.packs.resources.ResourceManagerReloadListener
public class BundleManager
extends Object
implements net.minecraft.server.packs.resources.ResourceManagerReloadListener
Bundle Manager that manages Bundle Lifecycles.
Script loading is sided:
register(Bundle)always loads common scripts.loadClientScripts()must be called from the client dist entrypoint.loadServerScripts()must be called from the server dist entrypoint.
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier, net.minecraft.server.packs.resources.PreparableReloadListener.SharedState, net.minecraft.server.packs.resources.PreparableReloadListener.StateKey<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidDiscovers and loads all bundles from the specified directory.Retrieves a bundle by its ID.Returns all currently loaded bundles.voidLoads client-side scripts for all registered bundles.voidLoads server-side scripts for all registered bundles.voidonResourceManagerReload(net.minecraft.server.packs.resources.ResourceManager resourceManager) voidRegisters a bundle and immediately loads its common-side scripts.voidreload()Reloads all bundles by clearing all script event callbacks, unloading current bundles, rediscovering them from disk, and re-loading common + server scripts.voidRemoves and cleans up a bundle, including closing its ZIP FileSystem if applicable.voidsetServer(net.minecraft.server.MinecraftServer server) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.server.packs.resources.PreparableReloadListener
getName, prepareSharedStateMethods inherited from interface net.minecraft.server.packs.resources.ResourceManagerReloadListener
reload
-
Constructor Details
-
BundleManager
-
-
Method Details
-
setServer
public void setServer(net.minecraft.server.MinecraftServer server) -
register
Registers a bundle and immediately loads its common-side scripts. -
loadClientScripts
public void loadClientScripts()Loads client-side scripts for all registered bundles. Call this fromFoundryEngineModClientduring client setup. -
loadServerScripts
public void loadServerScripts()Loads server-side scripts for all registered bundles. Call this fromFoundryEngineModServerduring server setup. -
remove
Removes and cleans up a bundle, including closing its ZIP FileSystem if applicable. -
discover
Discovers and loads all bundles from the specified directory.- Throws:
IOException
-
getBundles
Returns all currently loaded bundles. -
getBundle
-
reload
public void reload()Reloads all bundles by clearing all script event callbacks, unloading current bundles, rediscovering them from disk, and re-loading common + server scripts. -
getLifecycleDispatcher
-
getBundleDiscovery
-
onResourceManagerReload
public void onResourceManagerReload(net.minecraft.server.packs.resources.ResourceManager resourceManager) - Specified by:
onResourceManagerReloadin interfacenet.minecraft.server.packs.resources.ResourceManagerReloadListener
-