Skip to content

Commit

Permalink
fix a bunch of stuff
Browse files Browse the repository at this point in the history
slightly increases jar size but at least it's correct now
  • Loading branch information
rhysdh540 committed Jun 10, 2024
1 parent 63bc07d commit 3035160
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ fun applyProguard(jar: File, minecraftConfigs: List<MinecraftConfig>, configDir:
}

val debug = Properties().apply {
val gradleproperties = configDir.resolve("gradle.properties")
if (gradleproperties.exists()) {
load(gradleproperties.inputStream())
configDir.resolve("gradle.properties").also {
if (it.exists()) {
load(it.inputStream())
}
}
}.getProperty("zumegradle.proguard.keepAttrs").toBoolean()

Expand Down
4 changes: 2 additions & 2 deletions lexforge/src/main/java/dev/nolij/zume/lexforge/LexZume.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ private void calculateFOV(ViewportEvent.ComputeFov event) {
);

private void onMouseScroll(InputEvent.MouseScrollingEvent event) {
final int scrollAmount = (int) (double) GET_SCROLL_DELTA.invokeExact(event);
if (Zume.mouseScrollHook(scrollAmount)) {
//noinspection DataFlowIssue
if (Zume.mouseScrollHook((int) (double) GET_SCROLL_DELTA.invokeExact(event))) {
event.setCanceled(true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import dev.nolij.zume.api.util.v1.MethodHandleHelper;
import dev.nolij.zume.impl.Zume;
import dev.nolij.zumegradle.proguard.ProGuardKeep;
import io.github.prospector.modmenu.api.ModMenuApi;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
Expand All @@ -13,6 +14,7 @@

import static dev.nolij.zume.impl.ZumeConstants.MOD_ID;

@ProGuardKeep.WithObfuscation
public class ZumeModMenuIntegration implements ModMenuApi {

private static final MethodHandle LITERALTEXT_INIT = MethodHandleHelper.PUBLIC.getConstructorOrNull(
Expand Down
7 changes: 1 addition & 6 deletions proguard/1.pro
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,4 @@
}
-keepclassmembers,allowoptimization class dev.nolij.zume.** extends *.*.fml.client.config.GuiConfig {
public <methods>;
}

# Fabric entrypoints
-keep,allowoptimization,allowobfuscation class dev.nolij.zume.FabricZumeBootstrapper
-keep,allowoptimization,allowobfuscation class dev.nolij.zume.modern.integration.modmenu.ZumeModMenuIntegration
-keep,allowoptimization,allowobfuscation class dev.nolij.zume.primitive.event.KeyBindingRegistrar { public *; }
}
6 changes: 5 additions & 1 deletion proguard/common.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
-keepattributes Runtime*Annotations # keep annotations
-adaptclassstrings
-adaptresourcefilecontents fabric.mod.json

-keep @dev.nolij.zumegradle.proguard.ProGuardKeep class * { *; }
-keepclassmembers class * { @dev.nolij.zumegradle.proguard.ProGuardKeep *; }
-keepclassmembers class * { @dev.nolij.zumegradle.proguard.ProGuardKeep *; }

-keep,allowoptimization,allowobfuscation @dev.nolij.zumegradle.proguard.ProGuardKeep$WithObfuscation class * { *; }
-keepclassmembers,allowoptimization,allowobfuscation class * { @dev.nolij.zumegradle.proguard.ProGuardKeep$WithObfuscation *; }
2 changes: 2 additions & 0 deletions src/main/java/dev/nolij/zume/FabricZumeBootstrapper.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package dev.nolij.zume;

import dev.nolij.zume.impl.Zume;
import dev.nolij.zumegradle.proguard.ProGuardKeep;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
import net.fabricmc.loader.impl.gui.FabricGuiEntry;
import net.fabricmc.loader.impl.gui.FabricStatusTree;

@ProGuardKeep.WithObfuscation
public class FabricZumeBootstrapper implements ClientModInitializer, PreLaunchEntrypoint {

private static final String MISSING_DEPENDENCY_MESSAGE = """
Expand Down

0 comments on commit 3035160

Please sign in to comment.