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) {
|
||||
Path q = p.resolve(id + ".json");
|
||||
if (Files.exists(q)) {
|
||||
|
|
|
@ -38,17 +38,20 @@ 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 (!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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void respackopts$renderButton(MatrixStack matrices, boolean hovered, Identifier texture, int x, int y, int width, int height, int u, int v, int uWidth, int vHeight) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
|
|
@ -56,8 +56,6 @@ public class ResourcePackManagerMixin {
|
|||
}
|
||||
}
|
||||
});
|
||||
Respackopts.save();
|
||||
Respackopts.load();
|
||||
}
|
||||
|
||||
private void respackopts$registerFields(JsonObject data, String id, String keyPrefix) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user