Compare commits

..
Author SHA1 Message Date
FalsePattern a44be1dc1e update the buildscript and fix the deps 2022-07-02 18:40:49 +02:00
FalsePattern 53a9fa8cf7 placeholder biome slot system for mutations and auto-allocation avoidance 2022-07-02 13:40:37 +02:00
FalsePattern 948220dedc have to resort to this instead 2022-07-01 19:26:54 +02:00
FalsePattern d3d6e73f68 update publishing 2022-07-01 19:22:58 +02:00
FalsePattern 4cdc933192 restyle mixins 2022-07-01 19:06:29 +02:00
FalsePattern ba2b4e360a galacticraft compat 2022-07-01 19:00:21 +02:00
FalsePattern e86f0fc29f update project style 2022-07-01 18:59:42 +02:00
FalsePattern cad9285c10 reorganize 2022-07-01 18:59:19 +02:00
FalsePattern 73d7d3459e missed a require check here 2022-07-01 15:03:06 +02:00
FalsePattern d1666b582f Anti ID Conflict mod compatibility patch 2022-07-01 15:02:43 +02:00
FalsePattern 5ec489592a update buildscript again 2022-07-01 14:09:19 +02:00
FalsePattern b820a8af28 deobfuscate dependencies 2022-07-01 11:27:14 +02:00
FalsePattern 4cdbd06fda update buildscript 2022-07-01 10:58:31 +02:00
FalsePattern e3820669f8 upload code style 2022-06-18 23:28:30 +02:00
FalsePattern 42b2968fde BIDE porting... (add new mixins to enum) 2022-06-18 21:19:55 +02:00
FalsePattern 32e88ec680 BIDE porting... (some more worldgen) 2022-06-18 21:14:01 +02:00
FalsePattern b46cd34868 BIDE porting... (chunk and worldgen stuff) 2022-06-18 21:10:42 +02:00
FalsePattern 6bcf0e8bd5 BIDE porting... 2022-06-18 20:50:29 +02:00
FalsePattern e468253906 BIDE porting... 2022-06-17 21:53:59 +02:00
FalsePattern ed3adba5e3 merge constants classes 2022-06-17 14:37:03 +02:00
FalsePattern 2a72daa6cf begin porting over BIDE code (https://github.com/TCLProject/Biome-ID-Extender) 2022-06-16 23:30:47 +02:00
35 changed files with 1302 additions and 150 deletions

No files matched your search

+4 -4
View File
@@ -11,9 +11,6 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
steps:
- uses: actions/checkout@v2
with:
@@ -48,4 +45,7 @@ jobs:
files: build/libs/*.jar
- name: Publish to maven
run: ./gradlew publish
run: ./gradlew publish
env:
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
+2 -1
View File
@@ -145,4 +145,5 @@ gradle-app.setting
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java
srgmap.cfg
srgmap.cfg
!lib/*.jar
+66
View File
@@ -0,0 +1,66 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" />
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
</option>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" />
<emptyLine />
<package name="net.minecraft" withSubpackages="true" static="false" />
<package name="net.minecraftforge" withSubpackages="true" static="false" />
<package name="cpw" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="true" />
</value>
</option>
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
</JavaCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false" />
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ASSIGNMENT" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_METHOD_BRACKETS" value="true" />
<option name="ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION" value="true" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="RESOURCE_LIST_WRAP" value="1" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="THROWS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="THROWS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="ASSERT_STATEMENT_WRAP" value="1" />
<option name="ASSERT_STATEMENT_COLON_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<option name="PARAMETER_ANNOTATION_WRAP" value="1" />
<option name="VARIABLE_ANNOTATION_WRAP" value="5" />
<option name="ENUM_CONSTANTS_WRAP" value="2" />
<option name="WRAP_ON_TYPING" value="0" />
</codeStyleSettings>
</code_scheme>
</component>
+5
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
+5 -3
View File
@@ -7,11 +7,13 @@ EndlessIDs is a modern rewrite of NotEnoughIDs which increases the limit even mo
This mod also contains patches for the following mods:
- UndergroundBiomesConstructs
- More Fun Quicksand Mod
- WorldEdit
- AntiIDConflict
- CoFH Lib
- DragonAPI
- GalactiCraft
- More Fun Quicksand Mod
- UndergroundBiomesConstructs
- WorldEdit
Mods not listed here may or may not work. A good rule of thumb is that the more invasive a mod is, the higher the chance
it's broken without a patch once the IDs exceed 4096 and 32000.
+392 -66
View File
@@ -1,4 +1,4 @@
//version: 1641429628falsepattern18
//version: 1656003793falsepattern29
/*
DO NOT CHANGE THIS FILE!
@@ -9,11 +9,19 @@ Please check https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/build.gr
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory
import java.nio.file.Files
import java.nio.file.Paths
import java.util.concurrent.TimeUnit
import java.util.zip.ZipEntry
import java.util.zip.ZipInputStream
import java.util.zip.ZipOutputStream
buildscript {
repositories {
mavenLocal()
maven {
name = "forge"
url = "https://maven.minecraftforge.net"
@@ -30,20 +38,35 @@ buildscript {
name = "jitpack"
url = "https://jitpack.falsepattern.com/"
}
maven {
name = "mavenpattern"
url = "https://maven.falsepattern.com/"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.6'
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
classpath 'com.falsepattern:jtweaker:0.2.1'
}
}
plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'scala'
id("org.ajoberstar.grgit") version("3.1.1")
id("com.github.johnrengelman.shadow") version("4.0.4")
id("com.palantir.git-version") version("0.12.3")
id("maven-publish")
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
id 'org.ajoberstar.grgit' version '4.1.1'
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'com.palantir.git-version' version '0.13.0'
id 'de.undercouch.download' version '5.0.1'
id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false
}
apply plugin: 'com.falsepattern.jtweaker'
def out = services.get(StyledTextOutputFactory).create('an-output')
apply plugin: 'forge'
@@ -89,35 +112,42 @@ checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName")
//Properties added in fork
checkPropertyExists("skipBuildScriptUpdateCheck")
checkPropertyExists("repositoryURL")
checkPropertyExists("repositoryName")
checkPropertyExists("mavenGroupId")
checkPropertyExists("mavenArtifactId")
checkPropertyExists("hasMixinDeps")
checkPropertyExists("mixinPreinitConfig")
propertyDefaultIfUnset("skipBuildScriptUpdateCheck", false)
propertyDefaultIfUnset("repositoryURL", "")
propertyDefaultIfUnset("repositoryName", "")
propertyDefaultIfUnset("mavenGroupId", "")
propertyDefaultIfUnset("mavenArtifactId", "")
propertyDefaultIfUnset("hasMixinDeps", false)
propertyDefaultIfUnset("mixinPreinitConfig", "")
propertyDefaultIfUnset("remapStubs", false)
propertyDefaultIfUnset("remoteMappings", "https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/")
propertyDefaultIfUnset("mappingsChannel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/"
String kotlinSourceDir = "src/main/kotlin/"
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
if(apiPackage) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
}
if(accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if(getFile(targetFile).exists() == false) {
if(!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
}
@@ -129,15 +159,17 @@ if(usesMixins.toBoolean()) {
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin)
}
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}
@@ -145,8 +177,9 @@ if(coreModClass) {
String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) {
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin)
}
}
@@ -159,13 +192,35 @@ configurations.all {
}
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
'git config core.fileMode false'.execute()
// Pulls version from git tag
try {
version = gitVersion()
'git config core.fileMode false'.execute()
}
catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
catch (Exception ignored) {
out.style(Style.Failure).println("git isn't installed at all")
}
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
}
catch (Exception ignored) {
out.style(Style.Failure).text(
'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' +
'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' +
'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)'
)
versionOverride = 'NO-GIT-TAG-SET'
identifiedVersion = versionOverride
}
version = identifiedVersion
ext {
modVersion = identifiedVersion
}
if(identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
}
group = modGroup
@@ -190,7 +245,7 @@ minecraft {
replace gradleTokenModName, modName
}
if(gradleTokenVersion) {
replace gradleTokenVersion, versionDetails().lastTag
replace gradleTokenVersion, modVersion
}
if(gradleTokenGroupName) {
replace gradleTokenGroupName, modGroup
@@ -231,9 +286,9 @@ 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-SNAPSHOT")
annotationProcessor("org.spongepowered:mixin:0.8-20200110.181151-15")
// using 0.8 to workaround a issue in 0.7 which fails mixin application
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
compile("org.spongepowered:mixin:0.7.11-20180703.121122-1") {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
@@ -244,7 +299,7 @@ dependencies {
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
}
if(hasMixinDeps.toBoolean()) {
runtime("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
runtime("org.spongepowered:mixin:0.7.11-20180703.121122-1") {
// Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper"
exclude module: "guava"
@@ -284,6 +339,9 @@ task relocateShadowJar(type: ConfigureShadowRelocation) {
}
shadowJar {
if (remapStubs.toBoolean()) {
dependsOn(removeStub)
}
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
@@ -300,6 +358,9 @@ shadowJar {
}
jar {
if (remapStubs.toBoolean()) {
dependsOn(removeStub)
}
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
@@ -398,8 +459,7 @@ tasks.withType(JavaExec).configureEach {
)
}
processResources
{
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
@@ -408,9 +468,9 @@ processResources
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
// replace modVersion and minecraftVersion
expand "minecraftVersion": project.minecraft.version,
"modVersion": versionDetails().lastTag,
"modVersion": modVersion,
"modId": modId,
"modName": modName
}
@@ -419,7 +479,7 @@ processResources
from refMap
}
// copy everything else, thats not the mcmod.info
// copy everything else that's not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
@@ -427,7 +487,7 @@ processResources
def getManifestAttributes() {
def manifestAttributes = [:]
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
}
@@ -443,19 +503,22 @@ def getManifestAttributes() {
manifestAttributes += [
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs" : "mixins." + modId + ".json" + (mixinPreinitConfig ? "," + mixinPreinitConfig : ""),
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
]
}
return manifestAttributes
}
task sourcesJar(type: Jar) {
from (sourceSets.main.allJava)
from (sourceSets.main.allSource)
from (file("$projectDir/LICENSE"))
getArchiveClassifier().set('sources')
}
task shadowDevJar(type: ShadowJar) {
if (remapStubs.toBoolean()) {
dependsOn(removeStub)
}
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
@@ -485,6 +548,9 @@ task circularResolverJar(type: Jar) {
}
task devJar(type: Jar) {
if (remapStubs.toBoolean()) {
dependsOn(removeStub)
}
project.configurations.shadeCompile.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
@@ -505,7 +571,7 @@ task devJar(type: Jar) {
}
task apiJar(type: Jar) {
from (sourceSets.main.allJava) {
from (sourceSets.main.allSource) {
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
}
@@ -528,6 +594,15 @@ artifacts {
}
}
// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID),
// and isn't strictly needed with the POM so just disable it.
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
// workaround variable hiding in pom processing
def projectConfigs = project.configurations
// publishing
def getMavenSettingsCredentials = {
@@ -539,23 +614,20 @@ def getMavenSettingsCredentials = {
}
def getCredentials = {
try {
def entries = getMavenSettingsCredentials()
for (entry in entries) {
if (entry."id".text() == repositoryName) {
return [username: entry.username.text(), password: entry.password.text()]
String username = System.getenv("MAVEN_DEPLOY_USER")
String password = System.getenv("MAVEN_DEPLOY_PASSWORD")
if (username == null) {
try {
def entries = getMavenSettingsCredentials()
for (entry in entries) {
if (entry."id".text() == repositoryName) {
return [username: entry.username.text(), password: entry.password.text()]
}
}
}
throw new Exception();
} catch (Exception ignored) {
//Try from environment variables if file does not exist
String username = System.getenv("MAVEN_DEPLOY_USER")
String password = System.getenv("MAVEN_DEPLOY_PASSWORD")
if (username == null || password == null) {
return [username: null, password: null]
} else {
return [username: username, password: password]
}
} catch (Exception ignored){}
return [username: "none", password: "none"]
} else {
return [username: username, password: password]
}
}
@@ -563,9 +635,12 @@ def getCredentials = {
publishing {
publications {
maven(MavenPublication) {
artifact source: (jar.enabled ? jar : shadowJar)
artifact source: sourcesJar, classifier: "src"
artifact source: (devJar.enabled ? devJar : shadowDevJar), classifier: "dev"
from components.java
if(usesShadowedDependencies.toBoolean()) {
artifact source: shadowJar, classifier: ""
}
artifact source: sourcesJar, classifier: "sources"
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) {
artifact source: apiJar, classifier: "api"
}
@@ -573,6 +648,25 @@ publishing {
groupId = mavenGroupId
artifactId = mavenArtifactId + "-mc" + minecraftVersion
version = gitVersion()
// remove extra garbage from minecraft and minecraftDeps configuration
pom.withXml {
def badArtifacts = [:].withDefault {[] as Set<String>}
for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) {
for (dependency in configuration.allDependencies) {
badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name
}
}
// example for specifying extra stuff to ignore
// badArtifacts["org.example.group"] += "artifactName"
Node pomNode = asNode()
pomNode.dependencies.'*'.findAll() {
badArtifacts[it.groupId.text()].contains(it.artifactId.text())
}.each() {
it.parent().remove(it)
}
}
}
}
@@ -583,8 +677,8 @@ publishing {
url = repositoryURL
def creds = getCredentials()
credentials {
username = creds == null ? "none" : creds.username
password = creds == null ? "none" : creds.password
username = creds?.username ?: "none"
password = creds?.password ?: "none"
}
}
}
@@ -604,7 +698,7 @@ if (!skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(
if (autoUpdateBuildScript.toBoolean()) {
performBuildScriptUpdate(projectDir.toString())
} else {
println("Build script update available! Run 'gradle updateBuildScript'")
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
}
}
@@ -616,7 +710,7 @@ boolean performBuildScriptUpdate(String projectDir) {
if (isNewBuildScriptVersionAvailable(projectDir)) {
def buildscriptFile = getFile("build.gradle")
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
print("Build script updated. Please REIMPORT the project or RESTART your IDE!")
out.println("Build script updated. Please REIMPORT the project or RESTART your IDE!")
return true
}
return false
@@ -647,14 +741,246 @@ configure(updateBuildScript) {
description = 'Updates the build script to the latest version'
}
// Parameter Deobfuscation
task deobfParams {
doLast {
String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$mappingsChannel/$mappingsVersion"
String mcpZIP = "$mcpDir/mcp_$mappingsChannel-$mappingsVersion-${minecraftVersion}.zip"
String paramsCSV = "$mcpDir/params.csv"
download.run {
src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$mappingsChannel/$mappingsVersion-$minecraftVersion/mcp_$mappingsChannel-$mappingsVersion-${minecraftVersion}.zip"
dest mcpZIP
overwrite false
}
if(!file(paramsCSV).exists()) {
println("Extracting MCP archive ...")
unzip(mcpZIP, mcpDir)
}
println("Parsing params.csv ...")
Map<String, String> params = new HashMap<>()
Files.lines(Paths.get(paramsCSV)).forEach{line ->
String[] cells = line.split(",")
if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) {
params.put(cells[0], cells[1])
}
}
out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!")
out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.")
}
}
static int replaceParams(File file, Map<String, String> params) {
int fileCount = 0
if(file.isDirectory()) {
for(File f : file.listFiles()) {
fileCount += replaceParams(f, params)
}
return fileCount
}
println("Visiting ${file.getName()} ...")
try {
String content = new String(Files.readAllBytes(file.toPath()))
int hash = content.hashCode()
params.forEach{key, value ->
content = content.replaceAll(key, value)
}
if(hash != content.hashCode()) {
Files.write(file.toPath(), content.getBytes("UTF-8"))
return 1
}
} catch(Exception e) {
e.printStackTrace()
}
return 0
}
// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681)
static unzip(String zipFileName, String outputDir) {
byte[] buffer = new byte[16384]
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName))
ZipEntry zipEntry = zis.getNextEntry()
while (zipEntry != null) {
File newFile = new File(outputDir + File.separator, zipEntry.name)
if (zipEntry.isDirectory()) {
if (!newFile.isDirectory() && !newFile.mkdirs()) {
throw new IOException("Failed to create directory $newFile")
}
} else {
// fix for Windows-created archives
File parent = newFile.parentFile
if (!parent.isDirectory() && !parent.mkdirs()) {
throw new IOException("Failed to create directory $parent")
}
// write file content
FileOutputStream fos = new FileOutputStream(newFile)
int len = 0
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len)
}
fos.close()
}
zipEntry = zis.getNextEntry()
}
zis.closeEntry()
zis.close()
}
configure(deobfParams) {
group = 'forgegradle'
description = 'Rename all obfuscated parameter names inherited from Minecraft classes'
}
// Dependency Deobfuscation
def deobfMaven(mavenDep) {
throw new GradleException("deobfMaven(mavenDep) is deprecated. " +
"You must use the new deobfMaven(repoURL, mavenDep) method instead." +
"The old method broke the buildscript when used.")
}
def deobfMaven(String repoURL, String mavenDep) {
if (!repoURL.endsWith("/")) {
repoURL += "/"
}
String[] parts = mavenDep.split(":")
parts[0] = parts[0].replace('.', '/')
def jarURL = repoURL + parts[0] + "/" + parts[1] + "/" + parts[2] + "/" + parts[1] + "-" + parts[2] + ".jar"
return deobf(jarURL)
}
def deobf(String sourceURL) {
try {
URL url = new URL(sourceURL)
String fileName = url.getFile()
//get rid of directories:
int lastSlash = fileName.lastIndexOf("/")
if(lastSlash > 0) {
fileName = fileName.substring(lastSlash + 1)
}
//get rid of extension:
if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) {
fileName = fileName.substring(0, fileName.lastIndexOf("."))
}
String hostName = url.getHost()
if(hostName.startsWith("www.")) {
hostName = hostName.substring(4)
}
List parts = Arrays.asList(hostName.split("\\."))
Collections.reverse(parts)
hostName = String.join(".", parts)
return deobf(sourceURL, "$hostName/$fileName")
} catch(Exception e) {
return deobf(sourceURL, "deobf/${sourceURL.hashCode()}")
}
}
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
String bon2Dir = "$cacheDir/forge_gradle/deobf"
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
if(file(deobfFile).exists()) {
return files(deobfFile)
}
String mappingsVer
if(remoteMappings) {
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
mappingsVer = "snapshot_$id"
} else {
mappingsVer = "${mappingsChannel}_$mappingsVersion"
}
download.run {
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
dest bon2File
quiet true
overwrite false
}
download.run {
src sourceURL
dest obfFile
quiet true
overwrite false
}
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
workingDir bon2Dir
standardOutput = new FileOutputStream("${deobfFile}.log")
}
return files(deobfFile)
}
def zipMappings(String zipPath, String url, String bon2Dir) {
File zipFile = new File(zipPath)
if(zipFile.exists()) {
return
}
String fieldsCache = "$bon2Dir/data/fields.csv"
String methodsCache = "$bon2Dir/data/methods.csv"
download.run {
src "${url}fields.csv"
dest fieldsCache
quiet true
}
download.run {
src "${url}methods.csv"
dest methodsCache
quiet true
}
zipFile.getParentFile().mkdirs()
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
zos.putNextEntry(new ZipEntry("fields.csv"))
Files.copy(Paths.get(fieldsCache), zos)
zos.closeEntry()
zos.putNextEntry(new ZipEntry("methods.csv"))
Files.copy(Paths.get(methodsCache), zos)
zos.closeEntry()
zos.close()
}
// Helper methods
def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) {
if (!project.hasProperty(propertyName)) {
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/FalsePattern/ExampleMod1.7.10/blob/main/gradle.properties")
}
}
def propertyDefaultIfUnset(String propertyName, defaultValue) {
if (!project.hasProperty(propertyName)) {
project.ext.setProperty(propertyName, defaultValue)
}
}
def getFile(String relativePath) {
return new File(projectDir, relativePath)
}
+8 -18
View File
@@ -6,23 +6,13 @@ dependencies {
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.8.2:dev")
compileOnly("curse.maven:undergroundbiomesconstructs-72744:2304497") {
transitive = false
}
String curseMaven = "https://cursemaven.falsepattern.com/" //Use https://cursemaven.com/ if this is down
compileOnly(deobfMaven(curseMaven, "curse.maven:undergroundbiomesconstructs-72744:2304497")) // 0.8-beta49
compileOnly(deobfMaven(curseMaven, "curse.maven:more-fun-quicksand-mod-321960:2717318")) // 1.0.8.8-fixed
compileOnly(deobfMaven(curseMaven, "curse.maven:worldedit-225608:2309699")) // 6.1.1
compileOnly("curse.maven:cofh-lib-220333:2388748") // 1.2.1-185-dev
compileOnly(deobfMaven(curseMaven, "curse.maven:dragonapi-235591:3574508")) // V31b
compileOnly("curse.maven:more-fun-quicksand-mod-321960:2717318") {
transitive = false
}
compileOnly("curse.maven:worldedit-225608:2309699") {
transitive = false
}
compileOnly("curse.maven:cofh-lib-220333:2388747") {
transitive = false
}
compileOnly("curse.maven:dragonapi-235591:3574508") {
transitive = false
}
compileOnly(deobfMaven(curseMaven, "curse.maven:antiidconflict-246288:2308279")) // 1.3.5
compileOnly(files("lib/GalacticraftCore-1.7-3.0.12.504-deobf.jar"))
}
+6
View File
@@ -82,6 +82,12 @@ containsMixinsAndOrCoreModOnly = false
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# If enabled, class stubbing will be enabled. In this mode, all classes with a package named "stubpackage" in their
# path will be removed, and all classes that refer to said classes will be modified so that the "stubpackage" will map
# to the root package instead. This is useful for referring to compile-time inaccessible classes, such as classes in the
# default package
remapStubs = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
#customArchiveBaseName =
Binary file not shown.
@@ -1,10 +1,41 @@
package com.falsepattern.endlessids;
import code.elix_x.coremods.antiidconflict.managers.BiomesManager;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.world.biome.BiomeGenBase;
@Mod(modid = Tags.MODID,
version = Tags.VERSION,
name = Tags.MODNAME,
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:falsepatternlib@[0.8.2,);")
public class EndlessIDs {}
dependencies = "required-after:falsepatternlib@[0.8.2,);\n" +
"after:antiidconflict")
public class EndlessIDs {
public static final Logger LOG = LogManager.getLogger(Tags.MODNAME);
public static BiomeGenBase[] fakeBiomeArray;
public static boolean postInitFinished = false;
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent e) {
if (Loader.isModLoaded("antiidconflict")) {
antiIdConflictLatePatch();
}
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent e) {
postInitFinished = true;
fakeBiomeArray = null;
}
private static void antiIdConflictLatePatch() {
BiomesManager.conflicts = new BiomesManager.ConflictingBiomes[ExtendedConstants.biomeIDCount];
}
}
@@ -1,11 +1,14 @@
package com.falsepattern.endlessids;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
import lombok.val;
import net.minecraft.init.Blocks;
import net.minecraft.block.Block;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.chunk.Chunk;
import java.nio.ShortBuffer;
import java.nio.ByteBuffer;
@@ -134,5 +137,66 @@ public class Hooks {
}
throw new IllegalArgumentException("id out of range: " + id);
}
//Biome ID Extender Code
public static byte[] shortToByteArray(short[] shortArray) {
byte[] byteArray = new byte[512];
for(int i = 0; i < 256; ++i) {
byteArray[i] = (byte)(shortArray[i] & 255);
byteArray[i + 256] = (byte)(shortArray[i] >>> 8);
}
return byteArray;
}
public static short[] byteToShortArray(byte[] byteArray) {
short[] shortArray = new short[256];
for(int i = 0; i < 256; ++i) {
shortArray[i] = (short)(byteArray[i + 256] << 8 | byteArray[i]);
}
return shortArray;
}
public static short[] oldBiomeByteToNewShortArray(byte[] byteArray) {
short[] shortArray = new short[256];
for (int i = 0; i < 256; i++) {
shortArray[i] = (short)(byteArray[i] & 0xff);
}
return shortArray;
}
public static int readBiomeArrayFromPacket(Chunk chunk, byte[] array, int offset) {
byte[] byteArray = new byte[512];
System.arraycopy(array, offset, byteArray, 0, 512);
((IChunkMixin)chunk).setBiomeShortArray(byteToShortArray(byteArray));
return byteArray.length;
}
public static int writeBiomeArrayToPacket(Chunk chunk, byte[] array, int offset) {
byte[] byteArray = shortToByteArray(((IChunkMixin)chunk).getBiomeShortArray());
System.arraycopy(byteArray, 0, array, offset, 512);
return byteArray.length;
}
public static void writeChunkBiomeArrayToNbt(Chunk chunk, NBTTagCompound nbt) {
byte[] byteArray = shortToByteArray(((IChunkMixin)chunk).getBiomeShortArray());
nbt.setByteArray("Biomes16", byteArray);
}
public static void readChunkBiomeArrayFromNbt(Chunk chunk, NBTTagCompound nbt) {
short[] data = null;
if (nbt.hasKey("Biomes16", 7)) {
data = byteToShortArray(nbt.getByteArray("Biomes16"));
} else if (nbt.hasKey("Biomes", 7)) {
data = oldBiomeByteToNewShortArray(nbt.getByteArray("Biomes"));
}
if (data != null) {
((IChunkMixin)chunk).setBiomeShortArray(data);
}
}
}
@@ -0,0 +1,13 @@
package com.falsepattern.endlessids;
import net.minecraft.world.biome.BiomeGenBase;
public class PlaceholderBiome extends BiomeGenBase {
public PlaceholderBiome(int id, BiomeGenBase parent) {
super(id);
biomeName = "EndlessIDs ID conflict avoidance placeholder for ID " + parent.biomeID +
" [" + parent.getClass().getName() + "]";
}
}
@@ -9,8 +9,9 @@ public class ExtendedConstants {
public static final int countCorrectionBits = IEConfig.countCorrectionBits;
public static final int watchableBits = 7;
public static final int bitsPerBiome = 16;
//IDs
//BlockItemIDs
public static final int nibblesPerID = bitsPerID / 4;
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
@@ -24,11 +25,19 @@ public class ExtendedConstants {
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
public static final int bytesPerEBS = nibblesPerEBS / 2;
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
//BiomeIDs
public static final int biomeIDCount = 1 << bitsPerBiome;
public static final int biomeIDMask = biomeIDCount - 1;
public static final int biomeIDNull = biomeIDMask;
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
//DataWatcher
public static final int watchableCount = 1 << watchableBits;
public static final int maxWatchableID = watchableCount - 1;
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
//Chunk
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
}
@@ -7,8 +7,9 @@ public class VanillaConstants {
public static final int countCorrectionBits = 0;
public static final int watchableBits = 5;
public static final int bitsPerBiome = 8;
//IDs
//BlockItemIDs
public static final int nibblesPerID = bitsPerID / 4;
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
@@ -22,11 +23,19 @@ public class VanillaConstants {
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
public static final int nibblesPerBlock = bitsPerBlock / 4;
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
public static final int bytesPerEBS = nibblesPerEBS / 2;
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
//BiomeIDs
public static final int biomeIDCount = 1 << bitsPerBiome;
public static final int biomeIDMask = biomeIDCount - 1;
public static final int biomeIDNull = biomeIDMask;
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
//DataWatcher
public static final int watchableCount = 1 << watchableBits;
public static final int maxWatchableID = watchableCount - 1;
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
//Chunk
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
}
@@ -0,0 +1,8 @@
package com.falsepattern.endlessids.mixin.helpers;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
public interface IChunkMixin {
short[] getBiomeShortArray();
void setBiomeShortArray(short[] data);
}
@@ -101,7 +101,7 @@ public abstract class ChunkMixin {
}
if (var4) {
System.arraycopy(var1, var16, this.blockBiomeArray, 0, this.blockBiomeArray.length);
var16 += Hooks.readBiomeArrayFromPacket((Chunk)(Object)this, var1, var16);
}
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
@@ -0,0 +1,35 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import com.falsepattern.endlessids.EndlessIDs;
import lombok.val;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import sun.reflect.CallerSensitive;
import net.minecraft.world.biome.BiomeGenBase;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBaseMixin {
@Shadow @Final private static BiomeGenBase[] biomeList;
@CallerSensitive
@Redirect(method = "getBiomeGenArray",
at = @At(value = "FIELD",
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeList:[Lnet/minecraft/world/biome/BiomeGenBase;",
opcode = Opcodes.GETSTATIC),
require = 1)
private static BiomeGenBase[] returnFakeArray() {
if (!EndlessIDs.postInitFinished) {
val trace = Thread.currentThread().getStackTrace()[3];
if (trace.getMethodName().equals("updateBiomesFolder") &&
trace.getClassName().equals("code.elix_x.coremods.antiidconflict.managers.BiomesManager")) {
return EndlessIDs.fakeBiomeArray;
}
}
return biomeList;
}
}
@@ -0,0 +1,31 @@
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
import code.elix_x.coremods.antiidconflict.core.AsmHooks;
import com.falsepattern.endlessids.PlaceholderBiome;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.world.biome.BiomeGenBase;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBasePlaceholderMixin {
@Shadow @Final private static BiomeGenBase[] biomeList;
@SuppressWarnings({"InvalidInjectorMethodSignature", "UnresolvedMixinReference", "MixinAnnotationTarget"})
@Redirect(method = "<init>(IZ)V",
at = @At(value = "INVOKE",
target = "Lcode/elix_x/coremods/antiidconflict/core/AsmHooks;getBiomeID(IZ)I",
remap = false),
require = 1)
private int removePlaceholders(int id, boolean register) {
if (biomeList[id] instanceof PlaceholderBiome) {
biomeList[id] = null;
}
return AsmHooks.getBiomeID(id, register);
}
}
@@ -0,0 +1,26 @@
package com.falsepattern.endlessids.mixin.mixins.common.galacticraft;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import micdoodle8.mods.galacticraft.core.util.ConfigManagerCore;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(value = ConfigManagerCore.class,
remap = false)
public abstract class ConfigManagerCoreMixin {
@ModifyConstant(method = "syncConfig",
constant = @Constant(stringValue = "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."),
require = 1)
private static String modifyHint(String constant) {
return "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-" + (ExtendedConstants.biomeIDCount - 6);
}
@ModifyConstant(method = "syncConfig",
constant = @Constant(intValue = VanillaConstants.biomeIDCount - 6),
require = 1)
private static int modifyLimit(int constant) {
return ExtendedConstants.biomeIDCount - 6;
}
}
@@ -16,7 +16,7 @@ public abstract class BiomeUndergroundDecoratorMixin {
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;func_76658_g()[B"),
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B"),
require = 2)
private byte[] returnMSBasLSB(ExtendedBlockStorage instance) {
if (ebs == null) ebs = new ThreadLocal<>();
@@ -27,7 +27,7 @@ public abstract class BiomeUndergroundDecoratorMixin {
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;func_76660_i()Lnet/minecraft/world/chunk/NibbleArray;"),
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockMSBArray()Lnet/minecraft/world/chunk/NibbleArray;"),
require = 4)
private NibbleArray returnFakeArray(ExtendedBlockStorage instance) {
return fakeArray == null ? (fakeArray = new NibbleArray(4096, 4)) : fakeArray;
@@ -35,7 +35,7 @@ public abstract class BiomeUndergroundDecoratorMixin {
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/NibbleArray;func_76582_a(III)I"),
target = "Lnet/minecraft/world/chunk/NibbleArray;get(III)I"),
require = 2)
private int returnRestOfID(NibbleArray instance, int x, int y, int z) {
return ebs.get().getLSB()[y << 8 | z << 4 | x] & 0xFFFF;
@@ -0,0 +1,31 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.biome;
import com.falsepattern.endlessids.EndlessIDs;
import com.falsepattern.endlessids.PlaceholderBiome;
import lombok.val;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import java.util.Arrays;
@Mixin(value = BiomeDictionary.class,
remap = false)
public abstract class BiomeDictionaryMixin {
@Inject(method = "registerAllBiomesAndGenerateEvents",
at = @At("HEAD"),
require = 1)
private static void cleanupBiomeArray(CallbackInfo ci) {
val biomes = BiomeGenBase.getBiomeGenArray();
EndlessIDs.fakeBiomeArray = Arrays.copyOf(biomes, biomes.length);
for (int i = 0; i < biomes.length; i++) {
if (biomes[i] instanceof PlaceholderBiome) {
biomes[i] = null;
}
}
}
}
@@ -0,0 +1,42 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.biome;
import com.falsepattern.endlessids.PlaceholderBiome;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import net.minecraft.world.biome.BiomeGenBase;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBaseMixin {
@Shadow @Final private static BiomeGenBase[] biomeList;
@Shadow @Final public int biomeID;
@ModifyConstant(method = "<clinit>",
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
require = 1)
private static int extendBiomeList(int constant) {
return ExtendedConstants.biomeIDCount;
}
@Inject(method = "<init>(IZ)V",
at = @At(value = "RETURN"),
require = 1)
private void generatePlaceholders(int p_i1971_1_, boolean register, CallbackInfo ci) {
if (((Object)this) instanceof PlaceholderBiome) return;
if (biomeID >= 128 && biomeList[biomeID - 128] == null) {
new PlaceholderBiome(biomeID - 128, (BiomeGenBase) (Object) this);
}
if (biomeID <= ExtendedConstants.biomeIDCount - 129 && biomeList[biomeID + 128] == null) {
new PlaceholderBiome(biomeID + 128, (BiomeGenBase) (Object) this);
}
}
}
@@ -0,0 +1,32 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.biome;
import com.falsepattern.endlessids.PlaceholderBiome;
import org.spongepowered.asm.lib.Opcodes;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import net.minecraft.world.biome.BiomeGenBase;
@Mixin(BiomeGenBase.class)
public abstract class BiomeGenBasePlaceholderMixin {
@Shadow @Final private static BiomeGenBase[] biomeList;
@Mutable
@Shadow @Final public int biomeID;
@Redirect(method = "<init>(IZ)V",
at = @At(value = "FIELD",
opcode = Opcodes.PUTFIELD,
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeID:I"),
require = 1)
private void removePlaceholders(BiomeGenBase instance, int id) {
if (biomeList[id] instanceof PlaceholderBiome) {
biomeList[id] = null;
}
biomeID = id;
}
}
@@ -3,8 +3,10 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
import com.falsepattern.endlessids.Hooks;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
import net.minecraft.network.play.server.S21PacketChunkData;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -36,4 +38,12 @@ public abstract class S21PacketChunkDataMixin {
private static byte[] hookGetBlockData(ExtendedBlockStorage instance) {
return Hooks.getBlockData((IExtendedBlockStorageMixin) instance);
}
@Redirect(method = "func_149269_a",
at = @At(value = "INVOKE",
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
require = 1)
private static byte[] getBiomesArrayShort(Chunk instance) {
return Hooks.shortToByteArray(((IChunkMixin)instance).getBiomeShortArray());
}
}
@@ -9,11 +9,17 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(S26PacketMapChunkBulk.class)
public abstract class S26PacketMapChunkBulkMixin {
//TODO magic number
@ModifyConstant(method = "readPacketData",
constant = @Constant(intValue = VanillaConstants.bytesPerIDPlusMetadata * 0x1000),
constant = @Constant(intValue = VanillaConstants.bytesPerIDPlusMetadata * 16 * 16 * 16),
require = 1)
private int extend1(int constant) {
return ExtendedConstants.bytesPerIDPlusMetadata * 0x1000;
return ExtendedConstants.bytesPerIDPlusMetadata * 16 * 16 * 16;
}
@ModifyConstant(method = "readPacketData",
constant = @Constant(intValue = VanillaConstants.bytesPerBiome * 16 * 16),
require = 1)
private int extend2(int contant) {
return ExtendedConstants.bytesPerBiome * 16 * 16;
}
}
@@ -63,7 +63,7 @@ public abstract class AnvilChunkLoaderMixin {
}
p_75820_3_.setTag("Sections", var5);
p_75820_3_.setByteArray("Biomes", p_75820_1_.getBiomeArray());
Hooks.writeChunkBiomeArrayToNbt(p_75820_1_, p_75820_3_);
p_75820_1_.hasEntities = false;
NBTTagList var21 = new NBTTagList();
@@ -150,10 +150,7 @@ public abstract class AnvilChunkLoaderMixin {
}
var5.setStorageArrays(var8);
if (p_75823_2_.hasKey("Biomes", 7)) {
var5.setBiomeArray(p_75823_2_.getByteArray("Biomes"));
}
Hooks.readChunkBiomeArrayFromNbt(var5, p_75823_2_);
return var5;
}
}
@@ -0,0 +1,86 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.storage;
import com.falsepattern.endlessids.EndlessIDs;
import com.falsepattern.endlessids.Tags;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import lombok.val;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.chunk.Chunk;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Arrays;
@Mixin(Chunk.class)
public abstract class ChunkMixin implements IChunkMixin {
@Shadow private byte[] blockBiomeArray;
@Shadow @Final public int xPosition;
@Shadow @Final public int zPosition;
private short[] blockBiomeShortArray;
@Inject(method = "<init>(Lnet/minecraft/world/World;II)V",
at = @At(value = "RETURN"),
require = 1)
private void initShortArray(World p_i1995_1_, int p_i1995_2_, int p_i1995_3_, CallbackInfo ci) {
blockBiomeArray = null;
blockBiomeShortArray = new short[16 * 16];
Arrays.fill(blockBiomeShortArray, (short)-1);
}
private void emergencyCrash() {
val crashMSG = "A mod that is incompatible with " + Tags.MODNAME + " has tried to access the biome array of a" +
" chunk like in vanilla! Crashing in fear of potential world corruption!\n" +
"Please report this issue on https://github.com/FalsePattern/EndlessIDs ASAP!";
EndlessIDs.LOG.fatal(crashMSG);
throw new UnsupportedOperationException(crashMSG);
}
@Inject(method = "setBiomeArray",
at = @At(value = "HEAD"),
require = 1)
private void crashSetBiomeArray(byte[] p_76616_1_, CallbackInfo ci) {
emergencyCrash();
}
@Inject(method = "getBiomeArray",
at = @At(value = "HEAD"),
require = 1)
private void crashGetBiomeArray(CallbackInfoReturnable<byte[]> cir) {
emergencyCrash();
}
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public BiomeGenBase getBiomeGenForWorldCoords(int x, int z, WorldChunkManager manager) {
int id = this.blockBiomeShortArray[z << 4 | x] & ExtendedConstants.biomeIDMask;
if (id == ExtendedConstants.biomeIDNull) {
BiomeGenBase gen = manager.getBiomeGenAt((this.xPosition << 4) + x, (this.zPosition << 4) + z);
id = gen.biomeID;
this.blockBiomeShortArray[z << 4 | x] = (short) (id & ExtendedConstants.biomeIDMask);
}
return BiomeGenBase.getBiome(id) == null ? BiomeGenBase.plains : BiomeGenBase.getBiome(id);
}
@Override
public short[] getBiomeShortArray() {
return blockBiomeShortArray;
}
@Override
public void setBiomeShortArray(short[] data) {
blockBiomeShortArray = data;
}
}
@@ -0,0 +1,51 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.gen.ChunkProviderEnd;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Iterator;
import java.util.Random;
@Mixin(ChunkProviderEnd.class)
public abstract class ChunkProviderEndMixin {
@Shadow private Random endRNG;
@Shadow private BiomeGenBase[] biomesForGeneration;
@Shadow private World endWorld;
@Shadow public abstract void func_147420_a(int p_147420_1_, int p_147420_2_, Block[] p_147420_3_, BiomeGenBase[] p_147420_4_);
@Shadow public abstract void replaceBiomeBlocks(int p_147421_1_, int p_147421_2_, Block[] p_147421_3_, BiomeGenBase[] p_147421_4_, byte[] meta);
/**
* @author FalsePattern
* @reason Direct port from decompiled code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
this.endRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
Block[] blocks = new Block[32768];
byte[] metadatas = new byte[blocks.length];
this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
this.func_147420_a(x, z, blocks, this.biomesForGeneration);
this.replaceBiomeBlocks(x, z, blocks, this.biomesForGeneration, metadatas);
Chunk chunk = new Chunk(this.endWorld, blocks, metadatas, x, z);
short[] biomes = ((IChunkMixin)chunk).getBiomeShortArray();
for(int i = 0; i < biomes.length; ++i) {
biomes[i] = (short)this.biomesForGeneration[i].biomeID;
}
chunk.generateSkylightMap();
return chunk;
}
}
@@ -0,0 +1,75 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
import net.minecraft.world.gen.ChunkProviderFlat;
import net.minecraft.world.gen.MapGenBase;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Iterator;
import java.util.List;
@Mixin(ChunkProviderFlat.class)
public abstract class ChunkProviderFlatMixin implements IChunkProvider {
@Shadow private World worldObj;
@Shadow @Final private Block[] cachedBlockIDs;
@Shadow @Final private byte[] cachedBlockMetadata;
@Shadow @Final private List structureGenerators;
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
Chunk chunk = new Chunk(this.worldObj, x, z);
for(int Y = 0; Y < this.cachedBlockIDs.length; ++Y) {
Block block = this.cachedBlockIDs[Y];
if (block != null) {
int ebsID = Y >> 4;
ExtendedBlockStorage ebs = chunk.getBlockStorageArray()[ebsID];
if (ebs == null) {
ebs = new ExtendedBlockStorage(Y, !this.worldObj.provider.hasNoSky);
chunk.getBlockStorageArray()[ebsID] = ebs;
}
for(int X = 0; X < 16; ++X) {
for(int Z = 0; Z < 16; ++Z) {
ebs.func_150818_a(X, Y & 15, Z, block);
ebs.setExtBlockMetadata(X, Y & 15, Z, this.cachedBlockMetadata[Y]);
}
}
}
}
chunk.generateSkylightMap();
BiomeGenBase[] bgb = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(null, x * 16, z * 16, 16, 16);
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
for(int i = 0; i < biomeArray.length; ++i) {
biomeArray[i] = (short)bgb[i].biomeID;
}
for (Object o : this.structureGenerators) {
MapGenBase structureGenerator = (MapGenBase) o;
structureGenerator.func_151539_a(this, this.worldObj, x, z, null);
}
chunk.generateSkylightMap();
return chunk;
}
}
@@ -0,0 +1,79 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.structure.MapGenMineshaft;
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
import net.minecraft.world.gen.structure.MapGenStronghold;
import net.minecraft.world.gen.structure.MapGenVillage;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Random;
@Mixin(ChunkProviderGenerate.class)
public abstract class ChunkProviderGenerateMixin implements IChunkProvider {
@Shadow public abstract void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_);
@Shadow private Random rand;
@Shadow private BiomeGenBase[] biomesForGeneration;
@Shadow private World worldObj;
@Shadow public abstract void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_);
@Shadow private MapGenBase caveGenerator;
@Shadow private MapGenBase ravineGenerator;
@Shadow @Final private boolean mapFeaturesEnabled;
@Shadow private MapGenMineshaft mineshaftGenerator;
@Shadow private MapGenVillage villageGenerator;
@Shadow private MapGenStronghold strongholdGenerator;
@Shadow private MapGenScatteredFeature scatteredFeatureGenerator;
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
Block[] blocks = new Block[65536];
byte[] metadata = new byte[65536];
this.func_147424_a(x, z, blocks);
this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
this.replaceBlocksForBiome(x, z, blocks, metadata, this.biomesForGeneration);
this.caveGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.ravineGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
if (this.mapFeaturesEnabled) {
this.mineshaftGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.villageGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.strongholdGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
}
Chunk chunk = new Chunk(this.worldObj, blocks, metadata, x, z);
short[] biomes = ((IChunkMixin)chunk).getBiomeShortArray();
for(int i = 0; i < biomes.length; ++i) {
biomes[i] = (short)this.biomesForGeneration[i].biomeID;
}
chunk.generateSkylightMap();
return chunk;
}
}
@@ -0,0 +1,57 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderHell;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.structure.MapGenNetherBridge;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import java.util.Random;
@Mixin(ChunkProviderHell.class)
public abstract class ChunkProviderHellMixin implements IChunkProvider {
@Shadow private Random hellRNG;
@Shadow private World worldObj;
@Shadow public abstract void func_147419_a(int p_147419_1_, int p_147419_2_, Block[] p_147419_3_);
@Shadow public abstract void replaceBiomeBlocks(int p_147418_1_, int p_147418_2_, Block[] p_147418_3_, byte[] meta, BiomeGenBase[] biomes);
@Shadow private MapGenBase netherCaveGenerator;
@Shadow public MapGenNetherBridge genNetherBridge;
/**
* @author FalsePattern
* @reason Direct port from dumped code
*/
@Overwrite
public Chunk provideChunk(int x, int z) {
this.hellRNG.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
Block[] blocks = new Block[32768];
byte[] metadata = new byte[blocks.length];
BiomeGenBase[] bgb = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(null, x * 16, z * 16, 16, 16);
this.func_147419_a(x, z, blocks);
this.replaceBiomeBlocks(x, z, blocks, metadata, bgb);
this.netherCaveGenerator.func_151539_a(this, this.worldObj, x, z, blocks);
this.genNetherBridge.func_151539_a(this, this.worldObj, x, z, blocks);
Chunk chunk = new Chunk(this.worldObj, blocks, metadata, x, z);
short[] biomes = ((IChunkMixin)chunk).getBiomeShortArray();
for(int i = 0; i < biomes.length; ++i) {
biomes[i] = (short)bgb[i].biomeID;
}
chunk.resetRelightChecks();
return chunk;
}
}
@@ -0,0 +1,18 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import net.minecraft.world.gen.layer.GenLayerRiverMix;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(GenLayerRiverMix.class)
public abstract class GenLayerRiverMixMixin {
@ModifyConstant(method = "getInts",
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
require = 1)
private int extendTheID(int constant) {
return ExtendedConstants.biomeIDMask;
}
}
@@ -0,0 +1,19 @@
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
import com.falsepattern.endlessids.constants.ExtendedConstants;
import com.falsepattern.endlessids.constants.VanillaConstants;
import net.minecraft.world.gen.layer.GenLayerRiverMix;
import net.minecraft.world.gen.layer.GenLayerVoronoiZoom;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Mixin(GenLayerVoronoiZoom.class)
public abstract class GenLayerVoronoiZoomMixin {
@ModifyConstant(method = "getInts",
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
require = 2)
private int extendTheID(int constant) {
return ExtendedConstants.biomeIDMask;
}
}
@@ -14,50 +14,75 @@ import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.*;
@RequiredArgsConstructor
public enum Mixin implements IMixin {
//region Minecraft
//region common
//region storage
AnvilChunkLoaderMixin(Side.COMMON, always(), "vanilla.storage.AnvilChunkLoaderMixin"),
ExtendedBlockStorageMixin(Side.COMMON, always(), "vanilla.storage.ExtendedBlockStorageMixin"),
ItemStackMixin(Side.COMMON, always(), "vanilla.storage.ItemStackMixin"),
//endregion storage
//region networking
PacketBufferMixin(Side.COMMON, always(), "vanilla.networking.PacketBufferMixin"),
S21PacketChunkDataMixin(Side.COMMON, always(), "vanilla.networking.S21PacketChunkDataMixin"),
S22PacketMultiBlockChangeMixin(Side.COMMON, always(), "vanilla.networking.S22PacketMultiBlockChangeMixin"),
S24PacketBlockActionMixin(Side.COMMON, always(), "vanilla.networking.S24PacketBlockActionMixin"),
S26PacketMapChunkBulkMixin(Side.COMMON, always(), "vanilla.networking.S26PacketMapChunkBulkMixin"),
//endregion networking
//region misc
BlockFireMixin(Side.COMMON, always(), "vanilla.misc.BlockFireMixin"),
DataWatcherMixin(Side.COMMON, condition(() -> IEConfig.extendDataWatcher), "vanilla.misc.DataWatcherMixin"),
ItemInWorldManagerMixin(Side.COMMON, always(), "vanilla.misc.ItemInWorldManagerMixin"),
StatListMixin(Side.COMMON, always(), "vanilla.misc.StatListMixin"),
WorldMixin(Side.COMMON, always(), "vanilla.misc.WorldMixin"),
//endregion misc
//endregion common
//region client
ChunkMixin(Side.CLIENT, always(), "vanilla.ChunkMixin"),
NetHandlerPlayClientMixin(Side.CLIENT, always(), "vanilla.NetHandlerPlayClientMixin"),
PlayerControllerMPMixin(Side.CLIENT, always(), "vanilla.PlayerControllerMPMixin"),
RenderGlobalMixin(Side.CLIENT, always(), "vanilla.RenderGlobalMixin"),
//endregion client
//region Minecraft->common
//region Minecraft->common->storage
AnvilChunkLoaderMixin(Side.COMMON, always(), "vanilla.storage.AnvilChunkLoaderMixin"),
ChunkMixin(Side.COMMON, always(), "vanilla.storage.ChunkMixin"),
ExtendedBlockStorageMixin(Side.COMMON, always(), "vanilla.storage.ExtendedBlockStorageMixin"),
ItemStackMixin(Side.COMMON, always(), "vanilla.storage.ItemStackMixin"),
//endregion Minecraft->common->storage
//region Minecraft->common->networking
PacketBufferMixin(Side.COMMON, always(), "vanilla.networking.PacketBufferMixin"),
S21PacketChunkDataMixin(Side.COMMON, always(), "vanilla.networking.S21PacketChunkDataMixin"),
S22PacketMultiBlockChangeMixin(Side.COMMON, always(), "vanilla.networking.S22PacketMultiBlockChangeMixin"),
S24PacketBlockActionMixin(Side.COMMON, always(), "vanilla.networking.S24PacketBlockActionMixin"),
S26PacketMapChunkBulkMixin(Side.COMMON, always(), "vanilla.networking.S26PacketMapChunkBulkMixin"),
//endregion Minecraft->common->networking
//region Minecraft->common->biome
BiomeDictionaryMixin(Side.COMMON, always(), "vanilla.biome.BiomeDictionaryMixin"),
BiomeGenBaseMixin(Side.COMMON, always(), "vanilla.biome.BiomeGenBaseMixin"),
BiomesGenBasePlaceholderMixin(Side.COMMON, avoid(TargetedMod.ANTIIDCONFLICT), "vanilla.biome.BiomeGenBasePlaceholderMixin"),
//endregion Minecraft->common->biome
//region Minecraft->common->misc
BlockFireMixin(Side.COMMON, always(), "vanilla.misc.BlockFireMixin"),
DataWatcherMixin(Side.COMMON, condition(() -> IEConfig.extendDataWatcher), "vanilla.misc.DataWatcherMixin"),
ItemInWorldManagerMixin(Side.COMMON, always(), "vanilla.misc.ItemInWorldManagerMixin"),
StatListMixin(Side.COMMON, always(), "vanilla.misc.StatListMixin"),
WorldMixin(Side.COMMON, always(), "vanilla.misc.WorldMixin"),
//endregion Minecraft->common->misc
//region Minecraft->common->worldgen
ChunkProviderEndMixin(Side.COMMON, always(), "vanilla.worldgen.ChunkProviderEndMixin"),
ChunkProviderFlatMixin(Side.COMMON, always(), "vanilla.worldgen.ChunkProviderFlatMixin"),
ChunkProviderGenerateMixin(Side.COMMON, always(), "vanilla.worldgen.ChunkProviderGenerateMixin"),
ChunkProviderHellMixin(Side.COMMON, always(), "vanilla.worldgen.ChunkProviderHellMixin"),
GenLayerRiverMixMixin(Side.COMMON, always(), "vanilla.worldgen.GenLayerRiverMixMixin"),
GenLayerVoronoiZoomMixin(Side.COMMON, always(), "vanilla.worldgen.GenLayerVoronoiZoomMixin"),
//endregion Minecraft->common->worldgen
//endregion Minecraft->common
//region Minecraft->client
ChunkMixinClient(Side.CLIENT, always(), "vanilla.ChunkMixin"),
NetHandlerPlayClientMixin(Side.CLIENT, always(), "vanilla.NetHandlerPlayClientMixin"),
PlayerControllerMPMixin(Side.CLIENT, always(), "vanilla.PlayerControllerMPMixin"),
RenderGlobalMixin(Side.CLIENT, always(), "vanilla.RenderGlobalMixin"),
//endregion Minecraft->client
//endregion Minecraft
//region UBC->common
OreUBifierMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.OreUBifierMixin"),
BiomeUndergroundDecoratorMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.BiomeUndergroundDecoratorMixin"),
//endregion UBC->common
//region AntiIDConflict->common
AIDCBiomesGenBaseMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.BiomeGenBaseMixin"),
AIDCBiomesGenBasePlaceholderMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.BiomeGenBasePlaceholderMixin"),
//endregion AntiIDConflict->common
//region CoFHLib->common
CofhBlockHelperMixin(Side.COMMON, require(TargetedMod.COFHLIB), "cofhlib.BlockHelperMixin"),
CoFHLibCofhBlockHelperMixin(Side.COMMON, require(TargetedMod.COFHLIB), "cofhlib.BlockHelperMixin"),
//endregion CoFHLib->common
//region DragonAPI->common
BlockPropertiesMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.BlockPropertiesMixin"),
DragonAPIBlockPropertiesMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.BlockPropertiesMixin"),
//endregion DragonAPI->common
//region GalactiCraftCore->common
GalactiCraftCoreConfigManagerCoreMixin(Side.COMMON,
require(TargetedMod.GALACTICRAFTCORE),
"galacticraft.ConfigManagerCoreMixin"),
//endregion GalactiCraftCore->common
//region MFQM->common
MFQMMixin(Side.COMMON, require(TargetedMod.MFQM), "mfqm.MFQMMixin"),
MFQMDataWatcherMixin(Side.COMMON, require(TargetedMod.MFQM).and(condition(() -> IEConfig.extendDataWatcher)), "mfqm.MFQMDataWatcherMixin"),
MFQMMixin(Side.COMMON, require(TargetedMod.MFQM), "mfqm.MFQMMixin"),
MFQMDataWatcherMixin(Side.COMMON,
require(TargetedMod.MFQM).and(condition(() -> IEConfig.extendDataWatcher)),
"mfqm.MFQMDataWatcherMixin"),
//endregion MFQM->common
//region UBC->common
UBCOreUBifierMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.OreUBifierMixin"),
UBCBiomeUndergroundDecoratorMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.BiomeUndergroundDecoratorMixin"),
//endregion UBC->common
//region WorldEdit->common
BaseBlockMixin(Side.COMMON, require(TargetedMod.WORLDEDIT), "worldedit.BaseBlockMixin"),
WorldEditBaseBlockMixin(Side.COMMON, require(TargetedMod.WORLDEDIT), "worldedit.BaseBlockMixin"),
//endregion WorldEdit->common
;
@Getter
@@ -11,10 +11,12 @@ import static com.falsepattern.lib.mixin.ITargetedMod.PredicateHelpers.*;
@RequiredArgsConstructor
public enum TargetedMod implements ITargetedMod {
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
ANTIIDCONFLICT("Anti ID Conflict", false, startsWith("antiidconflict")),
COFHLIB("CoFH Lib", false, startsWith("cofhlib-")),
DRAGONAPI("DragonAPI", false, startsWith("dragonapi")),
GALACTICRAFTCORE("GalactiCraftCore", false, startsWith("galacticraftcore")),
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
WORLDEDIT("WorldEdit", false, startsWith("worldedit-")),
;