Just Enough Resources (JER)

Just Enough Resources (JER)

163M Downloads

LootTableHelper reloads resources

LatvianModder opened this issue ยท 0 comments

commented

public static LootTableManager getManager(@Nullable World world) {
if (world == null || world.getServer() == null) {
if (manager == null) {
manager = new LootTableManager(new LootPredicateManager());
SimpleReloadableResourceManager serverResourceManger = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA);
List<IResourcePack> packs = new LinkedList<>();
packs.add(new VanillaPack("minecraft"));
for (ModFileInfo mod : ModList.get().getModFiles()) {
packs.add(new ModFileResourcePack(mod.getFile()));
}
packs.forEach(serverResourceManger::addResourcePack);
serverResourceManger.addReloadListener(manager);
CompletableFuture<Unit> completableFuture = serverResourceManger.reloadResourcesAndThen(Util.getServerExecutor(), Minecraft.getInstance(), packs, CompletableFuture.completedFuture(Unit.INSTANCE));
Minecraft.getInstance().driveUntil(completableFuture::isDone);
}
return manager;
}
return world.getServer().getLootTableManager();
}

This code here makes all resources reload causing lots of lag when first joining world in SP. One of my solutions is to @Inject mixin at end of LootTableManager, grab list of loot tables, compile them into whatever the recipe format for JEI is on server side and then send least possible data to client to use JEI runtime helper for adding loot recipes