Compare commits

...
1 Commits
Author SHA1 Message Date
Raven Szewczyk ef378fb51b Java 12 compat: don't resize the potion array if already big enough.
The actual compatible resizing is done in Hodgepodge.
2023-01-23 17:48:06 +00:00
2 changed files with 24 additions and 18 deletions

No files matched your search

+8 -3
View File
@@ -1,4 +1,4 @@
//version: 1673027205 //version: 1674409054
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -144,6 +144,7 @@ propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "") propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "") propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
String javaSourceDir = "src/main/java/" String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/" String scalaSourceDir = "src/main/scala/"
@@ -411,7 +412,9 @@ shadowJar {
attributes(getManifestAttributes()) attributes(getManifestAttributes())
} }
minimize() // This will only allow shading for actually used classes if (minimizeShadowedDependencies.toBoolean()) {
minimize() // This will only allow shading for actually used classes
}
configurations = [ configurations = [
project.configurations.shadowImplementation, project.configurations.shadowImplementation,
project.configurations.shadowCompile project.configurations.shadowCompile
@@ -554,7 +557,9 @@ task shadowDevJar(type: ShadowJar) {
attributes(getManifestAttributes()) attributes(getManifestAttributes())
} }
minimize() // This will only allow shading for actually used classes if (minimizeShadowedDependencies.toBoolean()) {
minimize() // This will only allow shading for actually used classes
}
configurations = [ configurations = [
project.configurations.shadowImplementation, project.configurations.shadowImplementation,
project.configurations.shadowCompile project.configurations.shadowCompile
@@ -463,24 +463,25 @@ public class AlchemicalWizardry {
BloodMagicConfiguration.init(new File(event.getModConfigurationDirectory(), "AWWayofTime.cfg")); BloodMagicConfiguration.init(new File(event.getModConfigurationDirectory(), "AWWayofTime.cfg"));
// Custom config stuff goes here // Custom config stuff goes here
Potion[] potionTypes;
for (Field f : Potion.class.getDeclaredFields()) { if (Potion.potionTypes.length < 256) {
f.setAccessible(true); for (Field f : Potion.class.getDeclaredFields()) {
f.setAccessible(true);
try { try {
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) { if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
Field modfield = Field.class.getDeclaredField("modifiers"); Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true); modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL); modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
potionTypes = (Potion[]) f.get(null); final Potion[] oldPotionTypes = Potion.potionTypes;
final Potion[] newPotionTypes = new Potion[256]; final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length); System.arraycopy(oldPotionTypes, 0, newPotionTypes, 0, oldPotionTypes.length);
f.set(null, newPotionTypes); f.set(null, newPotionTypes);
}
} catch (Exception e) {
System.err.println("Severe error, please report this to the mod author:");
System.err.println(e);
} }
} catch (Exception e) {
System.err.println("Severe error, please report this to the mod author:");
System.err.println(e);
} }
} }
AlchemicalWizardry.lifeEssenceFluid = new LifeEssence("LifeEssence"); AlchemicalWizardry.lifeEssenceFluid = new LifeEssence("LifeEssence");