Skip to content

Commit

Permalink
bugfix(mac): don't hang the game during launch
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-kirby committed Aug 23, 2024
1 parent fcfed41 commit 1618332
Showing 6 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version_base = 1.14.0
version_base = 1.14.1

# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
Original file line number Diff line number Diff line change
@@ -11,6 +11,9 @@ public byte[] transform(String name, String transformedName, byte[] basicClass)
return new PatchMacMouse(basicClass).apply();
case "net.minecraft.world.WorldEntitySpawner":
return new PatchMinecraftSpawnChunkSpawning(basicClass).apply();
case "com.TominoCZ.FBP.gui.FBPGuiBlacklist":
case "com.TominoCZ.FBP.handler.FBPKeyInputHandler":
return new PatchMacMouseFBP(basicClass).apply();
case "com.tmtravlr.jaff.JAFFMod":
return new PatchJaffFishLiveInWater(basicClass).apply();
case "com.tmtravlr.jaff.JAFFEventHandler":
@@ -45,9 +48,6 @@ public byte[] transform(String name, String transformedName, byte[] basicClass)
case "net.darkhax.infoaccessories.info.InfoType":
return new PatchInfoAccCompass(basicClass).apply();
default:
if (transformedName.contains("com.TominoCZ.FBP")) {
return new PatchMacMouseFBP(basicClass).apply();
}
return basicClass;
}
}
21 changes: 21 additions & 0 deletions src/main/java/tv/darkosto/sevpatches/core/patches/PatchMac.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tv.darkosto.sevpatches.core.patches;

import java.util.Locale;

import static tv.darkosto.sevpatches.core.SevPatchesLoadingPlugin.LOGGER;

public abstract class PatchMac extends Patch {
public PatchMac(byte[] inputClass) {
super(inputClass);
}

@Override
public byte[] apply() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT);
if (!osName.contains("mac")) {
LOGGER.info("Not macOS, skipping {}", this.getClass().getName());
return inputClassBytes;
}
return super.apply();
}
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

import static tv.darkosto.sevpatches.core.SevPatchesLoadingPlugin.*;

public class PatchMacMouse extends Patch {
public class PatchMacMouse extends PatchMac {
public PatchMacMouse(byte[] inputClass) {
super(inputClass);
}
@@ -24,16 +24,6 @@ protected boolean patch() {
return true;
}

@Override
public byte[] apply() {
String osName = System.getProperty("os.name").toLowerCase(Locale.ROOT);
if (!osName.contains("mac")) {
LOGGER.info("Skipping mouse patch; os is not macOS");
return inputClassBytes;
}
return super.apply();
}

private InsnList generateInsns(boolean checkGrab) {
LabelNode label = new LabelNode();
InsnList insns = new InsnList();
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class PatchMacMouseFBP extends PatchMacMouse {
public class PatchMacMouseFBP extends PatchMac {
public PatchMacMouseFBP(byte[] inputClass) {
super(inputClass);
}
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"modid": "sevpatches",
"name": "SevPatches",
"description": "Consolidated patches for mods that are EOL used in SevTech: Ages",
"version": "1.14.0",
"version": "1.14.1",
"mcversion": "1.12.2",
"url": "https://www.curseforge.com/minecraft/mc-mods/sevpatches",
"updateUrl": "",

0 comments on commit 1618332

Please sign in to comment.