Skip to content

[Resource Loader] Server resources and data packs in 1.3-1.12 - #114

Open
SpaceWalkerRS wants to merge 4 commits into
gen2from
datapacks
Open

SpaceWalkerRS wants to merge 4 commits into
gen2from
datapacks

Conversation

@SpaceWalkerRS

Copy link
Copy Markdown
Member
  • enables server-side resource loading in 1.3-1.12
  • enables loading data packs from the datapacks/ directory in 1.3-1.12
  • no /datapacks command has been added in these versions yet

Server Resources

Server-side resource loading works much the same as client-side resource loading. Server resources should be placed in /data/<namespace>/ directories, from where they will be loaded automatically. You can retrieve server resources through the server resource manager.

ResourceManager resourceManager = ResourceManager.server();

// this gets the top resource at /data/example/cookies/chocolate_chip_cookie.json
Optional<Resource> resource = resourceManager.getResource(ResourceLocation.of("example", "cookies/chocolate_chip_cookie.json"));

Similarly, you can query all loaded data packs through the server pack repository.

ResourcePackRepository packRepository = ResourcePackRepository.server();

// this gets all data packs that are currently enabled
Collection<ResourcePack> datapacks = packRepository.openSelectedPacks();

Data Packs

Data packs will be loaded from the datapacks/ directory. Similarly to 1.13+, any data packs found will be enabled by default. At this time there is no /datapacks command in 1.3-1.12 where users can control which data packs are enabled, but the level.dat file is extended to include lists or enabled and disabled packs, and packs can of course be enabled/disabled programmatically.

Loot Tables, Advancements, and Command Functions

In 1.9-1.12 loot tables, advancements, and command functions, are loaded from the data/ directory. This is not changed, and resources discovered from there have precedence over resources loaded from data packs. In a way, the data/ directory acts as a data pack that is fixed at the top of the list.

@SpaceWalkerRS SpaceWalkerRS added the enhancement New feature or request label Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant