Fix moving packs and resizing the pack selection screen. It should be noted that this might cause desync between a config file and the game

This commit is contained in:
JFronny 2020-12-21 15:34:31 +01:00
parent 620f716d8e
commit 6c340d8354
3 changed files with 10 additions and 19 deletions

View File

@ -65,16 +65,6 @@ public class Respackopts implements ClientModInitializer {
}
}
public static void load() {
try {
for (String s : resPackMetas.keySet()) {
load(resPackMetas.get(s).id);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void load(String id) {
Path q = p.resolve(id + ".json");
if (Files.exists(q)) {

View File

@ -38,14 +38,17 @@ public abstract class ResourcePackEntryMixin extends AlwaysSelectedEntryListWidg
}
}
@Inject(at = @At("TAIL"), method = "mouseClicked(DDI)Z")
@Inject(at = @At("RETURN"), method = "mouseClicked(DDI)Z", cancellable = true)
public void mouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> info) {
if (this.isSelectable()) {
String k = pack.getDisplayName().asString();
if (Respackopts.resPackMetas.containsKey(k) && respackopts$selected) {
Respackmeta meta = Respackopts.resPackMetas.get(k);
MinecraftClient c = MinecraftClient.getInstance();
c.openScreen(Respackopts.factory.buildGui(meta.conf, meta.id, c.currentScreen, () -> Respackopts.forceRespackReload = true));
if (!info.getReturnValue()) {
if (this.isSelectable()) {
String k = pack.getDisplayName().asString();
if (Respackopts.resPackMetas.containsKey(k) && respackopts$selected) {
info.setReturnValue(true);
Respackmeta meta = Respackopts.resPackMetas.get(k);
MinecraftClient c = MinecraftClient.getInstance();
c.openScreen(Respackopts.factory.buildGui(meta.conf, meta.id, c.currentScreen, () -> Respackopts.forceRespackReload = true));
}
}
}
}

View File

@ -56,8 +56,6 @@ public class ResourcePackManagerMixin {
}
}
});
Respackopts.save();
Respackopts.load();
}
private void respackopts$registerFields(JsonObject data, String id, String keyPrefix) {