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:
parent
620f716d8e
commit
6c340d8354
|
@ -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) {
|
public static void load(String id) {
|
||||||
Path q = p.resolve(id + ".json");
|
Path q = p.resolve(id + ".json");
|
||||||
if (Files.exists(q)) {
|
if (Files.exists(q)) {
|
||||||
|
|
|
@ -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) {
|
public void mouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> info) {
|
||||||
if (this.isSelectable()) {
|
if (!info.getReturnValue()) {
|
||||||
String k = pack.getDisplayName().asString();
|
if (this.isSelectable()) {
|
||||||
if (Respackopts.resPackMetas.containsKey(k) && respackopts$selected) {
|
String k = pack.getDisplayName().asString();
|
||||||
Respackmeta meta = Respackopts.resPackMetas.get(k);
|
if (Respackopts.resPackMetas.containsKey(k) && respackopts$selected) {
|
||||||
MinecraftClient c = MinecraftClient.getInstance();
|
info.setReturnValue(true);
|
||||||
c.openScreen(Respackopts.factory.buildGui(meta.conf, meta.id, c.currentScreen, () -> Respackopts.forceRespackReload = 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,6 @@ public class ResourcePackManagerMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Respackopts.save();
|
|
||||||
Respackopts.load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void respackopts$registerFields(JsonObject data, String id, String keyPrefix) {
|
private void respackopts$registerFields(JsonObject data, String id, String keyPrefix) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user