Replace cloth config with sodium gui
This commit is contained in:
@@ -74,16 +74,14 @@ dependencies {
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
//TODO: this is to eventually not need sodium installed as atm its just used for parsing shaders
|
||||
modRuntimeOnly "maven.modrinth:sodium:mc1.21.5-0.6.12-fabric"
|
||||
modCompileOnly "maven.modrinth:sodium:mc1.21.5-0.6.12-fabric"
|
||||
modRuntimeOnly "maven.modrinth:sodium:mc1.21.5-0.6.13-fabric"
|
||||
modCompileOnly "maven.modrinth:sodium:mc1.21.5-0.6.13-fabric"
|
||||
|
||||
modImplementation("maven.modrinth:lithium:mc1.21.5-0.16.0-fabric")
|
||||
|
||||
//modRuntimeOnly "maven.modrinth:nvidium:0.2.6-beta"
|
||||
modCompileOnly "maven.modrinth:nvidium:0.2.8-beta"
|
||||
|
||||
modImplementation("maven.modrinth:cloth-config:18.0.145+fabric")
|
||||
|
||||
modImplementation("maven.modrinth:modmenu:14.0.0-rc.2")
|
||||
|
||||
modCompileOnly("maven.modrinth:iris:1.8.5+1.21.4-fabric")
|
||||
|
||||
@@ -13,6 +13,8 @@ import java.util.Random;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
|
||||
public class VoxyClientInstance extends VoxyInstance {
|
||||
public static boolean isInGame = false;
|
||||
|
||||
private static final ContextSelectionSystem SELECTOR = new ContextSelectionSystem();
|
||||
|
||||
public VoxyClientInstance() {
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import me.cortex.voxy.common.Logger;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.storage.OptionStorage;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
import java.io.FileReader;
|
||||
@@ -12,12 +13,13 @@ import java.lang.reflect.Modifier;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class VoxyConfig {
|
||||
public class VoxyConfig implements OptionStorage<VoxyConfig> {
|
||||
private static final Gson GSON = new GsonBuilder()
|
||||
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
|
||||
.setPrettyPrinting()
|
||||
.excludeFieldsWithModifiers(Modifier.PRIVATE)
|
||||
.create();
|
||||
|
||||
public static VoxyConfig CONFIG = loadOrCreate();
|
||||
|
||||
public boolean enabled = true;
|
||||
@@ -26,13 +28,14 @@ public class VoxyConfig {
|
||||
public int sectionRenderDistance = 16;
|
||||
public int serviceThreads = Math.max(Runtime.getRuntime().availableProcessors()/2, 1);
|
||||
public float subDivisionSize = 128;
|
||||
public int secondaryLruCacheSize = 1024;
|
||||
|
||||
public static VoxyConfig loadOrCreate() {
|
||||
var path = getConfigPath();
|
||||
if (Files.exists(path)) {
|
||||
try (FileReader reader = new FileReader(path.toFile())) {
|
||||
return GSON.fromJson(reader, VoxyConfig.class);
|
||||
var conf = GSON.fromJson(reader, VoxyConfig.class);
|
||||
conf.save();
|
||||
return conf;
|
||||
} catch (IOException e) {
|
||||
Logger.error("Could not parse config",e);
|
||||
}
|
||||
@@ -41,6 +44,7 @@ public class VoxyConfig {
|
||||
config.save();
|
||||
return config;
|
||||
}
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
Files.writeString(getConfigPath(), GSON.toJson(this));
|
||||
@@ -54,4 +58,9 @@ public class VoxyConfig {
|
||||
.getConfigDir()
|
||||
.resolve("voxy-config.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxyConfig getData() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
package me.cortex.voxy.client.config;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import me.cortex.voxy.client.core.IGetVoxyRenderSystem;
|
||||
import me.cortex.voxy.commonImpl.IVoxyWorld;
|
||||
import me.cortex.voxy.commonImpl.VoxyCommon;
|
||||
import me.shedaniel.clothconfig2.api.ConfigBuilder;
|
||||
import me.shedaniel.clothconfig2.api.ConfigCategory;
|
||||
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public class VoxyConfigScreenFactory implements ModMenuApi {
|
||||
private static VoxyConfig DEFAULT;
|
||||
|
||||
private static boolean ON_SAVE_RELOAD_ALL = false;
|
||||
private static boolean ON_SAVE_RELOAD_RENDERER = false;
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> buildConfigScreen(parent, VoxyConfig.CONFIG);
|
||||
}
|
||||
|
||||
private static Screen buildConfigScreen(Screen parent, VoxyConfig config) {
|
||||
if (DEFAULT == null) {
|
||||
DEFAULT = new VoxyConfig();
|
||||
}
|
||||
ConfigBuilder builder = ConfigBuilder.create()
|
||||
.setParentScreen(parent)
|
||||
.setTitle(Text.translatable("voxy.config.title"));
|
||||
|
||||
|
||||
addGeneralCategory(builder, config);
|
||||
//addThreadsCategory(builder, config);
|
||||
//addStorageCategory(builder, config);
|
||||
|
||||
builder.setSavingRunnable(() -> {
|
||||
//After saving the core should be reloaded/reset
|
||||
var worldRenderer = MinecraftClient.getInstance().worldRenderer;
|
||||
var world = ((IVoxyWorld) MinecraftClient.getInstance().world);
|
||||
if (worldRenderer != null && (ON_SAVE_RELOAD_ALL||ON_SAVE_RELOAD_RENDERER)) {
|
||||
//Shudown renderer
|
||||
((IGetVoxyRenderSystem) worldRenderer).shutdownRenderer();
|
||||
}
|
||||
//Shutdown world
|
||||
if (world != null && ON_SAVE_RELOAD_ALL) {
|
||||
world.shutdownEngine();
|
||||
}
|
||||
//Shutdown instance
|
||||
if (ON_SAVE_RELOAD_ALL) {
|
||||
VoxyCommon.shutdownInstance();
|
||||
|
||||
//Create instance
|
||||
if (VoxyConfig.CONFIG.enabled)
|
||||
VoxyCommon.createInstance();
|
||||
}
|
||||
|
||||
if (worldRenderer != null && (ON_SAVE_RELOAD_ALL||ON_SAVE_RELOAD_RENDERER)) {
|
||||
//Create renderer
|
||||
((IGetVoxyRenderSystem) worldRenderer).createRenderer();
|
||||
}
|
||||
|
||||
ON_SAVE_RELOAD_RENDERER = false;
|
||||
ON_SAVE_RELOAD_ALL = false;
|
||||
VoxyConfig.CONFIG.save();
|
||||
});
|
||||
|
||||
return builder.build();//
|
||||
}
|
||||
|
||||
private static void reloadAll() {
|
||||
ON_SAVE_RELOAD_ALL = true;
|
||||
}
|
||||
|
||||
private static void reloadRender() {
|
||||
ON_SAVE_RELOAD_RENDERER = true;
|
||||
}
|
||||
|
||||
private static void addGeneralCategory(ConfigBuilder builder, VoxyConfig config) {
|
||||
ConfigCategory category = builder.getOrCreateCategory(Text.translatable("voxy.config.general"));
|
||||
ConfigEntryBuilder entryBuilder = builder.entryBuilder();
|
||||
|
||||
category.addEntry(entryBuilder.startBooleanToggle(Text.translatable("voxy.config.general.enabled"), config.enabled)
|
||||
.setTooltip(Text.translatable("voxy.config.general.enabled.tooltip"))
|
||||
.setSaveConsumer(val -> {if (config.enabled != val) reloadAll(); config.enabled = val;})
|
||||
.setDefaultValue(DEFAULT.enabled)
|
||||
.build());
|
||||
|
||||
category.addEntry(entryBuilder.startBooleanToggle(Text.translatable("voxy.config.general.ingest"), config.ingestEnabled)
|
||||
.setTooltip(Text.translatable("voxy.config.general.ingest.tooltip"))
|
||||
.setSaveConsumer(val -> config.ingestEnabled = val)
|
||||
.setDefaultValue(DEFAULT.ingestEnabled)
|
||||
.build());
|
||||
|
||||
category.addEntry(entryBuilder.startBooleanToggle(Text.translatable("voxy.config.general.rendering"), config.enableRendering)
|
||||
.setTooltip(Text.translatable("voxy.config.general.rendering.tooltip"))
|
||||
.setSaveConsumer(val -> {if (config.enableRendering != val) reloadRender(); config.enableRendering = val;})
|
||||
.setDefaultValue(DEFAULT.enableRendering)
|
||||
.build());
|
||||
|
||||
category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.subDivisionSize"), (int) config.subDivisionSize, 25, 256)
|
||||
.setTooltip(Text.translatable("voxy.config.general.subDivisionSize.tooltip"))
|
||||
.setSaveConsumer(val -> config.subDivisionSize = val)
|
||||
.setDefaultValue((int) DEFAULT.subDivisionSize)
|
||||
.build());
|
||||
|
||||
category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.renderDistance"), config.sectionRenderDistance, 2, 64)
|
||||
.setTooltip(Text.translatable("voxy.config.general.renderDistance.tooltip"))
|
||||
.setSaveConsumer(val -> {
|
||||
if (config.sectionRenderDistance != val) {
|
||||
config.sectionRenderDistance = val;
|
||||
var wrenderer = ((IGetVoxyRenderSystem) (MinecraftClient.getInstance().worldRenderer));
|
||||
if (wrenderer != null && wrenderer.getVoxyRenderSystem() != null) {
|
||||
wrenderer.getVoxyRenderSystem().setRenderDistance(val);
|
||||
}
|
||||
}
|
||||
})
|
||||
.setDefaultValue(DEFAULT.sectionRenderDistance)
|
||||
.build());
|
||||
|
||||
//category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.lruCacheSize"), config.secondaryLruCacheSize, 16, 1<<13)
|
||||
// .setTooltip(Text.translatable("voxy.config.general.lruCacheSize.tooltip"))
|
||||
// .setSaveConsumer(val ->{if (config.secondaryLruCacheSize != val) reload(); config.secondaryLruCacheSize = val;})
|
||||
// .setDefaultValue(DEFAULT.secondaryLruCacheSize)
|
||||
// .build());
|
||||
|
||||
category.addEntry(entryBuilder.startIntSlider(Text.translatable("voxy.config.general.serviceThreads"), config.serviceThreads, 1, Runtime.getRuntime().availableProcessors())
|
||||
.setTooltip(Text.translatable("voxy.config.general.serviceThreads.tooltip"))
|
||||
.setSaveConsumer(val ->{if (config.serviceThreads != val) reloadAll(); config.serviceThreads = val;})
|
||||
.setDefaultValue(DEFAULT.serviceThreads)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package me.cortex.voxy.client.config;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import me.cortex.voxy.client.VoxyClientInstance;
|
||||
import me.cortex.voxy.client.core.IGetVoxyRenderSystem;
|
||||
import me.cortex.voxy.common.Logger;
|
||||
import me.cortex.voxy.commonImpl.IVoxyWorld;
|
||||
import me.cortex.voxy.commonImpl.VoxyCommon;
|
||||
import net.caffeinemc.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionGroup;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpact;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionImpl;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionPage;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.control.SliderControl;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.control.TickBoxControl;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VoxyConfigScreenPages implements ModMenuApi {
|
||||
public static OptionPage voxyOptionPage = null;
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> {
|
||||
var screen = (SodiumOptionsGUI)SodiumOptionsGUI.createScreen(parent);
|
||||
//Sorry jelly and douira, please dont hurt me
|
||||
try {
|
||||
//We cant use .setPage() as that invokes rebuildGui, however the screen hasnt been initalized yet
|
||||
// causing things to crash
|
||||
var field = SodiumOptionsGUI.class.getDeclaredField("currentPage");
|
||||
field.setAccessible(true);
|
||||
field.set(screen, voxyOptionPage);
|
||||
field.setAccessible(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("Failed to set the current page to voxy", e);
|
||||
}
|
||||
return screen;
|
||||
};
|
||||
}
|
||||
|
||||
public static OptionPage page() {
|
||||
List<OptionGroup> groups = new ArrayList<>();
|
||||
VoxyConfig storage = VoxyConfig.CONFIG;
|
||||
|
||||
//General
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, storage)
|
||||
.setName(Text.translatable("voxy.config.general.enabled"))
|
||||
.setTooltip(Text.translatable("voxy.config.general.enabled.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((s, v)->{
|
||||
s.enabled = v;
|
||||
if (v) {
|
||||
if (VoxyClientInstance.isInGame) {
|
||||
VoxyCommon.createInstance();
|
||||
var vrsh = (IGetVoxyRenderSystem) MinecraftClient.getInstance().worldRenderer;
|
||||
if (vrsh != null && s.enableRendering) {
|
||||
vrsh.createRenderer();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var vrsh = (IGetVoxyRenderSystem) MinecraftClient.getInstance().worldRenderer;
|
||||
if (vrsh != null) {
|
||||
vrsh.shutdownRenderer();
|
||||
}
|
||||
var world = (IVoxyWorld) MinecraftClient.getInstance().world;
|
||||
if (world != null) {
|
||||
world.shutdownEngine();
|
||||
}
|
||||
VoxyCommon.shutdownInstance();
|
||||
}
|
||||
}, s -> s.enabled)
|
||||
.build()
|
||||
).add(OptionImpl.createBuilder(int.class, storage)
|
||||
.setName(Text.translatable("voxy.config.general.serviceThreads"))
|
||||
.setTooltip(Text.translatable("voxy.config.general.serviceThreads.tooltip"))
|
||||
.setControl(opt->new SliderControl(opt, 1, Runtime.getRuntime().availableProcessors(), 1, v->Text.literal(Integer.toString(v))))
|
||||
.setBinding((s, v)->{
|
||||
boolean wasEnabled = VoxyCommon.getInstance() != null;
|
||||
var vrsh = (IGetVoxyRenderSystem) MinecraftClient.getInstance().worldRenderer;
|
||||
if (wasEnabled) {
|
||||
if (vrsh != null) {
|
||||
vrsh.shutdownRenderer();
|
||||
}
|
||||
var world = (IVoxyWorld) MinecraftClient.getInstance().world;
|
||||
if (world != null) {
|
||||
world.shutdownEngine();
|
||||
}
|
||||
|
||||
VoxyCommon.shutdownInstance();
|
||||
}
|
||||
|
||||
s.serviceThreads = v;
|
||||
|
||||
if (wasEnabled) {
|
||||
VoxyCommon.createInstance();
|
||||
|
||||
if (vrsh != null && s.enableRendering) {
|
||||
vrsh.createRenderer();
|
||||
}
|
||||
}
|
||||
}, s -> s.serviceThreads)
|
||||
.setImpact(OptionImpact.HIGH)
|
||||
.build()
|
||||
).add(OptionImpl.createBuilder(boolean.class, storage)
|
||||
.setName(Text.translatable("voxy.config.general.ingest"))
|
||||
.setTooltip(Text.translatable("voxy.config.general.ingest.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((s, v) -> s.ingestEnabled = v, s -> s.ingestEnabled)
|
||||
.setImpact(OptionImpact.MEDIUM)
|
||||
.build()
|
||||
).build()
|
||||
);
|
||||
|
||||
groups.add(OptionGroup.createBuilder()
|
||||
.add(OptionImpl.createBuilder(boolean.class, storage)
|
||||
.setName(Text.translatable("voxy.config.general.rendering"))
|
||||
.setTooltip(Text.translatable("voxy.config.general.rendering.tooltip"))
|
||||
.setControl(TickBoxControl::new)
|
||||
.setBinding((s, v)->{
|
||||
s.enableRendering = v;
|
||||
var vrsh = (IGetVoxyRenderSystem)MinecraftClient.getInstance().worldRenderer;
|
||||
if (vrsh != null) {
|
||||
if (v) {
|
||||
vrsh.createRenderer();
|
||||
} else {
|
||||
vrsh.shutdownRenderer();
|
||||
}
|
||||
}
|
||||
}, s -> s.enableRendering)
|
||||
.build()
|
||||
).add(OptionImpl.createBuilder(int.class, storage)
|
||||
.setName(Text.translatable("voxy.config.general.subDivisionSize"))
|
||||
.setTooltip(Text.translatable("voxy.config.general.subDivisionSize.tooltip"))
|
||||
.setControl(opt->new SliderControl(opt, 28, 256, 1, v->Text.literal(Integer.toString(v))))
|
||||
.setBinding((s, v)->s.subDivisionSize = v, s -> (int) s.subDivisionSize)
|
||||
.setImpact(OptionImpact.HIGH)
|
||||
.build()
|
||||
).add(OptionImpl.createBuilder(int.class, storage)
|
||||
.setName(Text.translatable("voxy.config.general.renderDistance"))
|
||||
.setTooltip(Text.translatable("voxy.config.general.renderDistance.tooltip"))
|
||||
.setControl(opt->new SliderControl(opt, 2, 64, 1, v->Text.literal(Integer.toString(v * 32))))//Every unit is equal to 32 vanilla chunks
|
||||
.setBinding((s, v)-> {
|
||||
s.sectionRenderDistance = v;
|
||||
var vrsh = (IGetVoxyRenderSystem)MinecraftClient.getInstance().worldRenderer;
|
||||
if (vrsh != null) {
|
||||
var vrs = vrsh.getVoxyRenderSystem();
|
||||
if (vrs != null) {
|
||||
vrs.setRenderDistance(v);
|
||||
}
|
||||
}
|
||||
}, s -> s.sectionRenderDistance)
|
||||
.setImpact(OptionImpact.LOW)
|
||||
.build()
|
||||
).build()
|
||||
);
|
||||
return new OptionPage(Text.translatable("voxy.config.title"), ImmutableList.copyOf(groups));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.cortex.voxy.client.mixin.minecraft;
|
||||
|
||||
import me.cortex.voxy.client.LoadException;
|
||||
import me.cortex.voxy.client.VoxyClientInstance;
|
||||
import me.cortex.voxy.client.config.VoxyConfig;
|
||||
import me.cortex.voxy.commonImpl.VoxyCommon;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@@ -21,6 +22,7 @@ import java.util.function.Consumer;
|
||||
public class MixinClientLoginNetworkHandler {
|
||||
@Inject(method = "<init>", at = @At(value = "TAIL"))
|
||||
private void voxy$init(ClientConnection connection, MinecraftClient client, ServerInfo serverInfo, Screen parentScreen, boolean newWorld, Duration worldLoadTime, Consumer statusConsumer, CookieStorage cookieStorage, CallbackInfo ci) {
|
||||
VoxyClientInstance.isInGame = true;
|
||||
if (VoxyConfig.CONFIG.enabled) {
|
||||
VoxyCommon.createInstance();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.cortex.voxy.client.mixin.minecraft;
|
||||
|
||||
import me.cortex.voxy.client.VoxyClientInstance;
|
||||
import me.cortex.voxy.client.config.VoxyConfig;
|
||||
import me.cortex.voxy.commonImpl.VoxyCommon;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
@@ -13,14 +14,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
public class MixinMinecraftClient {
|
||||
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/resource/PeriodicNotificationManager;<init>(Lnet/minecraft/util/Identifier;Lit/unimi/dsi/fastutil/objects/Object2BooleanFunction;)V", shift = At.Shift.AFTER))
|
||||
private void injectRenderDoc(RunArgs args, CallbackInfo ci) {
|
||||
//System.load("C:\\Program Files\\RenderDoc\\renderdoc.dll");
|
||||
}
|
||||
|
||||
@Inject(method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;Z)V", at = @At("TAIL"))
|
||||
private void voxy$injectWorldClose(CallbackInfo ci) {
|
||||
VoxyCommon.shutdownInstance();
|
||||
VoxyClientInstance.isInGame = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package me.cortex.voxy.client.mixin.sodium;
|
||||
|
||||
import me.cortex.voxy.client.config.VoxyConfigScreenPages;
|
||||
import net.caffeinemc.mods.sodium.client.gui.SodiumOptionsGUI;
|
||||
import net.caffeinemc.mods.sodium.client.gui.options.OptionPage;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(SodiumOptionsGUI.class)
|
||||
public class MixinSodiumOptionsGUI {
|
||||
@Shadow @Final private List<OptionPage> pages;
|
||||
|
||||
@Inject(method = "<init>", at = @At("TAIL"))
|
||||
private void voxy$addConfigPage(Screen prevScreen, CallbackInfo ci) {
|
||||
this.pages.add(VoxyConfigScreenPages.voxyOptionPage = VoxyConfigScreenPages.page());
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,9 @@ public class MixinFabricWorld {
|
||||
@WrapOperation(method = "getChunkAtAsync", at = @At(value = "INVOKE", target = "Lorg/popcraft/chunky/mixin/ServerChunkCacheMixin;invokeGetChunkFutureMainThread(IILnet/minecraft/world/chunk/ChunkStatus;Z)Ljava/util/concurrent/CompletableFuture;"))
|
||||
private CompletableFuture<OptionalChunk<Chunk>> captureGeneratedChunk(ServerChunkCacheMixin instance, int i, int j, ChunkStatus chunkStatus, boolean b, Operation<CompletableFuture<OptionalChunk<Chunk>>> original) {
|
||||
var future = original.call(instance, i, j, chunkStatus, b);
|
||||
if (true) {//TODO: ADD SERVER CONFIG THING
|
||||
return future;
|
||||
} else {
|
||||
return future.thenApplyAsync(res -> {
|
||||
res.ifPresent(chunk -> {
|
||||
var voxyInstance = VoxyCommon.getInstance();
|
||||
@@ -34,3 +37,4 @@ public class MixinFabricWorld {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
{
|
||||
"voxy.config.title": "Voxy config",
|
||||
|
||||
"voxy.config.general": "General",
|
||||
|
||||
"voxy.config.general.enabled": "Enable Voxy",
|
||||
"voxy.config.general.enabled.tooltip": "Fully enables or disables voxy",
|
||||
|
||||
"voxy.config.general.rendering": "Voxy Rendering",
|
||||
"voxy.config.general.rendering.tooltip": "Enables or disables voxy rendering",
|
||||
"voxy.config.general.serviceThreads": "Service threads",
|
||||
"voxy.config.general.serviceThreads.tooltip": "Number of threads the ServiceThreadPool can use",
|
||||
|
||||
"voxy.config.general.ingest": "Chunk Ingest",
|
||||
"voxy.config.general.ingest.tooltip": "Enables or disables voxies ability to convert new chunks into LoDs",
|
||||
|
||||
"voxy.config.general.serviceThreads": "Service threads",
|
||||
"voxy.config.general.serviceThreads.tooltip": "Number of threads the ServiceThreadPool can use",
|
||||
"voxy.config.general.rendering": "Voxy Rendering",
|
||||
"voxy.config.general.rendering.tooltip": "Enables or disables voxy rendering",
|
||||
|
||||
"voxy.config.general.subDivisionSize": "Pixels^2 of subdivision size",
|
||||
"voxy.config.general.subDivisionSize.tooltip": "Maximum size in pixels (squared) of screenspace AABB before subdiving to smaller LoDs (Smaller being higher quality)",
|
||||
|
||||
"voxy.config.general.renderDistance": "Render distance",
|
||||
"voxy.config.general.renderDistance.tooltip": "Render distance of voxy, each unit is equivalent to 32 chunks in vanilla (i.e. to get to vanilla render distance multiply by 32)"
|
||||
"voxy.config.general.renderDistance.tooltip": "Render distance of voxy in chunks"
|
||||
}
|
||||
@@ -11,7 +11,8 @@
|
||||
"minecraft.MixinWindow",
|
||||
"minecraft.MixinWorldRenderer",
|
||||
"sodium.MixinDefaultChunkRenderer",
|
||||
"sodium.MixinRenderSectionManager"
|
||||
"sodium.MixinRenderSectionManager",
|
||||
"sodium.MixinSodiumOptionsGUI"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"me.cortex.voxy.client.VoxyClient"
|
||||
],
|
||||
"modmenu": [
|
||||
"me.cortex.voxy.client.config.VoxyConfigScreenFactory"
|
||||
"me.cortex.voxy.client.config.VoxyConfigScreenPages"
|
||||
],
|
||||
"main": [
|
||||
"me.cortex.voxy.commonImpl.VoxyCommon"
|
||||
@@ -35,8 +35,7 @@
|
||||
"minecraft": "1.21.5",
|
||||
"fabricloader": ">=0.14.22",
|
||||
"fabric-api": ">=0.91.1",
|
||||
"cloth-config": ">=13",
|
||||
"sodium": "*"
|
||||
"sodium": ">=0.6.13"
|
||||
},
|
||||
"accessWidener": "voxy.accesswidener"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user