Merge pull request #16 from GTNewHorizons/java12

Don't resize the potions array if already large - for Java 12+ compat
This commit is contained in:
Martin Robertz authored and GitHub committed 2023-01-24 17:06:29 +01:00
commit aed6ea5d58
3 files changed
+51 -26

No files matched your search

+35 -12
View File
@@ -1,4 +1,4 @@
//version: 1666827308
//version: 1674409054
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -31,7 +31,7 @@ buildscript {
url 'https://maven.minecraftforge.net'
}
maven {
// GTNH ForgeGradle Fork
// GTNH ForgeGradle and ASM Fork
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
@@ -45,7 +45,9 @@ buildscript {
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.9'
//Overwrite the current ASM version to fix shading newer than java 8 applicatations.
classpath 'org.ow2.asm:asm-debug-all-custom:5.0.3'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2.13'
}
}
plugins {
@@ -142,6 +144,7 @@ propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
@@ -278,7 +281,9 @@ minecraft {
runDir = 'run'
if (replaceGradleTokenInFile) {
replaceIn replaceGradleTokenInFile
for (f in replaceGradleTokenInFile.split(',')) {
replaceIn f
}
if (gradleTokenModId) {
replace gradleTokenModId, modId
}
@@ -315,9 +320,13 @@ if (file('addon.gradle').exists()) {
apply from: 'repositories.gradle'
configurations {
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
implementation.extendsFrom(shadowCompile)
implementation.extendsFrom(shadeCompile)
// TODO: remove Compile after all uses are refactored to Implementation
for (config in [shadowImplementation, shadowCompile, shadeCompile]) {
compileClasspath.extendsFrom(config)
runtimeClasspath.extendsFrom(config)
testCompileClasspath.extendsFrom(config)
testRuntimeClasspath.extendsFrom(config)
}
}
repositories {
@@ -330,6 +339,12 @@ repositories {
name = "GTNH Maven"
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
}
if (usesMixinDebug.toBoolean()) {
maven {
name = "Fabric Maven"
url = "https://maven.fabricmc.net/"
}
}
}
}
@@ -338,10 +353,14 @@ dependencies {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('org.spongepowered:mixin:0.8.5-GTNH:processor')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.3:processor')
if (usesMixinDebug.toBoolean()) {
runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
compile('com.gtnewhorizon:gtnhmixins:2.0.1')
compile('com.gtnewhorizon:gtnhmixins:2.1.3')
}
}
@@ -393,7 +412,9 @@ shadowJar {
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 = [
project.configurations.shadowImplementation,
project.configurations.shadowCompile
@@ -536,7 +557,9 @@ task shadowDevJar(type: ShadowJar) {
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 = [
project.configurations.shadowImplementation,
project.configurations.shadowCompile
@@ -694,7 +717,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
}
}
if (usesMixins.toBoolean()) {
addModrinthDep("required", "version", "gtnhmixins")
addModrinthDep("required", "project", "gtnhmixins")
}
tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth)
+7 -7
View File
@@ -1,18 +1,18 @@
// Add your dependencies here
dependencies {
compile 'com.github.GTNewHorizons:NotEnoughItems:2.2.5-GTNH:dev'
compile 'com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev'
compile 'com.github.GTNewHorizons:waila:1.5.18:dev'
compile 'com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev'
compile 'com.github.GTNewHorizons:ForgeMultipart:1.3.1:dev'
compile 'com.github.GTNewHorizons:waila:1.5.22:dev'
compile 'com.github.GTNewHorizons:Baubles:1.0.1.14:dev'
compile 'com.github.GTNewHorizons:Mantle:0.3.4:dev'
compile 'com.github.GTNewHorizons:BloodMagic:1.3.5:dev'
compile('com.github.GTNewHorizons:TinkersConstruct:1.9.0.13-GTNH:dev') {
compile 'com.github.GTNewHorizons:Mantle:0.3.5:dev'
compile 'com.github.GTNewHorizons:BloodMagic:1.3.22:dev'
compile('com.github.GTNewHorizons:TinkersConstruct:1.9.12-GTNH:dev') {
transitive = false
}
compile 'com.github.GTNewHorizons:Guide-API:1.0.2:dev'
compile 'thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev'
compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {
compileOnly('com.github.GTNewHorizons:AppleCore:3.2.5:dev') {
transitive = false
}
}
@@ -101,16 +101,18 @@ public class BloodArsenal {
try {
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
potionTypes = (Potion[]) f.get(null);
final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
f.set(null, newPotionTypes);
if (potionTypes.length < 256) {
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
f.set(null, newPotionTypes);
}
}
} catch (Exception e) {
logger.error("ポケモン!");
logger.error("Could not resize potions array!");
logger.error(e);
}
}