chore: use new DSL for resource pack menu config screen

This commit is contained in:
Johannes Frohnmeyer 2023-08-14 14:31:21 +02:00
parent 202dc3a79e
commit 6b44fdf9d3
Signed by: Johannes
GPG Key ID: E76429612C2929F4
1 changed files with 5 additions and 2 deletions

View File

@ -1,8 +1,9 @@
package io.gitlab.jfronny.respackopts.mixin;
import com.mojang.blaze3d.systems.RenderSystem;
import io.gitlab.jfronny.libjf.config.api.v1.ConfigInstance;
import io.gitlab.jfronny.libjf.config.api.v1.dsl.DSL;
import io.gitlab.jfronny.libjf.config.api.v1.ui.tiny.ConfigScreen;
import io.gitlab.jfronny.libjf.config.api.v2.ui.ConfigScreenFactory;
import io.gitlab.jfronny.respackopts.model.cache.CacheKey;
import io.gitlab.jfronny.respackopts.util.MetaCache;
import net.minecraft.client.MinecraftClient;
@ -45,7 +46,9 @@ public abstract class ResourcePackEntryMixin {
info.setReturnValue(true);
MinecraftClient c = MinecraftClient.getInstance();
String id = MetaCache.getId(dataLocation);
c.setScreen(ConfigScreen.create(DSL.create(id).config(builder -> MetaCache.getBranch(dataLocation).buildConfig(builder, id, dataLocation.dataLocation())), c.currentScreen));
ConfigInstance ci = DSL.create(id).config(builder -> MetaCache.getBranch(dataLocation).buildConfig(builder, id, dataLocation.dataLocation()));
ConfigScreenFactory.Built<?> screen = ConfigScreenFactory.getInstance().create(ci, c.currentScreen);
c.setScreen(screen.get());
}
}
}