From 3b13c6ba69cb10fd848ea176b909895764433630 Mon Sep 17 00:00:00 2001 From: GreatThane Date: Sat, 27 Oct 2018 19:53:57 -0500 Subject: [PATCH] Adds condition argument to SpirePatch, which allows a boolean value to determine whether to apply the patch. Adds the possibility to lower file sizes and load times. --- src/main/java/com/evacipated/cardcrawl/modthespire/Patcher.java | 2 ++ .../com/evacipated/cardcrawl/modthespire/lib/SpirePatch.java | 1 + 2 files changed, 3 insertions(+) diff --git a/src/main/java/com/evacipated/cardcrawl/modthespire/Patcher.java b/src/main/java/com/evacipated/cardcrawl/modthespire/Patcher.java index 5764f6c3..4690009b 100644 --- a/src/main/java/com/evacipated/cardcrawl/modthespire/Patcher.java +++ b/src/main/java/com/evacipated/cardcrawl/modthespire/Patcher.java @@ -206,6 +206,8 @@ public static HashSet injectPatches(ClassLoader loader, ClassPool pool, } for (SpirePatch patch : patchArr) { + if (!patch.condition()) continue; + CtClass ctClsToPatch = null; try { if (!patch.clz().equals(void.class)) { diff --git a/src/main/java/com/evacipated/cardcrawl/modthespire/lib/SpirePatch.java b/src/main/java/com/evacipated/cardcrawl/modthespire/lib/SpirePatch.java index 4032dc2c..5e6b44ac 100644 --- a/src/main/java/com/evacipated/cardcrawl/modthespire/lib/SpirePatch.java +++ b/src/main/java/com/evacipated/cardcrawl/modthespire/lib/SpirePatch.java @@ -12,6 +12,7 @@ Class[] paramtypez() default {void.class}; String[] paramtypes() default {"DEFAULT"}; boolean optional() default false; + boolean condition() default true; String CONSTRUCTOR = ""; String STATICINITIALIZER = "";