mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-27 21:23:05 +00:00
Compare commits
61
Commits
1.3.0
...
1.4.0-alpha0010
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24796dab0c | ||
|
|
3ceaa51119 | ||
|
|
eebb1d629e | ||
|
|
b1c8d1edb2 | ||
|
|
4b23b1949c | ||
|
|
0e32ffebae | ||
|
|
ef52fa6e51 | ||
|
|
42c59a668f | ||
|
|
9d24a015ff | ||
|
|
3b85cf7db5 | ||
|
|
15803fceff | ||
|
|
4a185892ea | ||
|
|
a2d354dd38 | ||
|
|
5c3f35a855 | ||
|
|
1082b5538f | ||
|
|
9bb729071b | ||
|
|
f28d5fbc3e | ||
|
|
3c53ecf624 | ||
|
|
0c3e745afa | ||
|
|
d594898485 | ||
|
|
85689649bd | ||
|
|
04ddf0c29a | ||
|
|
fb6fb88a49 | ||
|
|
8e23dd1f07 | ||
|
|
362e1dc9ca | ||
|
|
a2774e84ef | ||
|
|
f315774db4 | ||
|
|
6e66066f65 | ||
|
|
76a9345665 | ||
|
|
bf57fac244 | ||
|
|
f2450e0bda | ||
|
|
72a65de83f | ||
|
|
254a438ba1 | ||
|
|
88174167ae | ||
|
|
31ba27c584 | ||
|
|
d3dfc3dbc2 | ||
|
|
f099ac4bf7 | ||
|
|
9735717af4 | ||
|
|
7de5788013 | ||
|
|
413a113a4c | ||
|
|
a44be1dc1e | ||
|
|
53a9fa8cf7 | ||
|
|
948220dedc | ||
|
|
d3d6e73f68 | ||
|
|
4cdc933192 | ||
|
|
ba2b4e360a | ||
|
|
e86f0fc29f | ||
|
|
cad9285c10 | ||
|
|
73d7d3459e | ||
|
|
d1666b582f | ||
|
|
5ec489592a | ||
|
|
b820a8af28 | ||
|
|
4cdbd06fda | ||
|
|
e3820669f8 | ||
|
|
42b2968fde | ||
|
|
32e88ec680 | ||
|
|
b46cd34868 | ||
|
|
6bcf0e8bd5 | ||
|
|
e468253906 | ||
|
|
ed3adba5e3 | ||
|
|
2a72daa6cf |
No files matched your search
@@ -11,9 +11,6 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
MAVEN_DEPLOY_USER: ${{ secrets.MAVEN_DEPLOY_USER }}
|
|
||||||
MAVEN_DEPLOY_PASSWORD: ${{ secrets.MAVEN_DEPLOY_PASSWORD }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
@@ -48,4 +45,7 @@ jobs:
|
|||||||
files: build/libs/*.jar
|
files: build/libs/*.jar
|
||||||
|
|
||||||
- name: Publish to maven
|
- 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
@@ -145,4 +145,5 @@ gradle-app.setting
|
|||||||
|
|
||||||
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java
|
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,java
|
||||||
|
|
||||||
srgmap.cfg
|
srgmap.cfg
|
||||||
|
!lib/*.jar
|
||||||
Generated
+66
@@ -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>
|
||||||
Generated
+5
@@ -0,0 +1,5 @@
|
|||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
@@ -1,20 +1,48 @@
|
|||||||
EndlessIDs is a modern rewrite of NotEnoughIDs which increases the limit even more, up to the maximum 24 bit unsigned integer value.
|
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
|
||||||
|
new limits.
|
||||||
|
|
||||||
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
Comparison of the known limits:
|
||||||
|-----------|---------|--------------|------------|
|
|
||||||
| Block IDs | 4096 | 32000 | 16777216 |
|
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
||||||
| Item IDs | 32000 | 32000 | 16777216 |
|
|-----------------|----------------------------------------------------|--------------|----------------------------------|
|
||||||
|
| Block IDs | 4,096 | 32,000 | 16,777,216 |
|
||||||
|
| Item IDs | 32,000 | 32,000 | 16,777,216 |
|
||||||
|
| Biome IDs | 256 | 256 | 65,536 |
|
||||||
|
| Entity IDs | 256 | 256 | 256 right now, extension planned |
|
||||||
|
| Potion IDs | 32 | 32 | 32 right now, extension planned |
|
||||||
|
| Enchantment IDs | 256 | 256 | 256 right now, extension planned |
|
||||||
|
| Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same |
|
||||||
|
|
||||||
This mod also contains patches for the following mods:
|
This mod also contains patches for the following mods:
|
||||||
|
|
||||||
- UndergroundBiomesConstructs
|
- Alternate Terrain Generation
|
||||||
- More Fun Quicksand Mod
|
- Antique Atlas
|
||||||
- WorldEdit
|
- Anti ID Conflict
|
||||||
|
- ArchaicFix
|
||||||
|
- Biomes O' Plenty
|
||||||
- CoFH Lib
|
- CoFH Lib
|
||||||
- DragonAPI
|
- DragonAPI
|
||||||
|
- Extra Utilities
|
||||||
|
- GalactiCraft
|
||||||
|
- Immersive Cavegen
|
||||||
|
- More Fun Quicksand Mod
|
||||||
|
- Nature's Compass
|
||||||
|
- Realistic Terrain Generation
|
||||||
|
- Thaumcraft
|
||||||
|
- Twilight Forest
|
||||||
|
- Underground Biomes Constructs
|
||||||
|
- 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
|
Mods not listed here may or may not work.
|
||||||
it's broken without a patch once the IDs exceed 4096 and 32000.
|
|
||||||
|
- For item/block IDs:
|
||||||
|
- 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.
|
||||||
|
- For biome IDs:
|
||||||
|
- If a mod adds a custom world generator, it has a high chance of invoking an old vanilla method in the worldgen code.
|
||||||
|
|
||||||
|
To avoid world corruption and broken biomes, this method has been replaced with an instant crash that refers the
|
||||||
|
user to this github repo.
|
||||||
|
|
||||||
If you find any crashes or incompatibilities, don't hesitate to open an issue.
|
If you find any crashes or incompatibilities, don't hesitate to open an issue.
|
||||||
|
|
||||||
|
|||||||
+392
-66
@@ -1,4 +1,4 @@
|
|||||||
//version: 1641429628falsepattern18
|
//version: 1656003793falsepattern29
|
||||||
/*
|
/*
|
||||||
DO NOT CHANGE THIS FILE!
|
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.ConfigureShadowRelocation
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
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.concurrent.TimeUnit
|
||||||
|
import java.util.zip.ZipEntry
|
||||||
|
import java.util.zip.ZipInputStream
|
||||||
|
import java.util.zip.ZipOutputStream
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
maven {
|
maven {
|
||||||
name = "forge"
|
name = "forge"
|
||||||
url = "https://maven.minecraftforge.net"
|
url = "https://maven.minecraftforge.net"
|
||||||
@@ -30,20 +38,35 @@ buildscript {
|
|||||||
name = "jitpack"
|
name = "jitpack"
|
||||||
url = "https://jitpack.falsepattern.com/"
|
url = "https://jitpack.falsepattern.com/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = "mavenpattern"
|
||||||
|
url = "https://maven.falsepattern.com/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
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 {
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
id 'idea'
|
id 'idea'
|
||||||
|
id 'eclipse'
|
||||||
id 'scala'
|
id 'scala'
|
||||||
id("org.ajoberstar.grgit") version("3.1.1")
|
id 'maven-publish'
|
||||||
id("com.github.johnrengelman.shadow") version("4.0.4")
|
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
|
||||||
id("com.palantir.git-version") version("0.12.3")
|
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
|
||||||
id("maven-publish")
|
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'
|
apply plugin: 'forge'
|
||||||
|
|
||||||
@@ -89,35 +112,42 @@ checkPropertyExists("usesShadowedDependencies")
|
|||||||
checkPropertyExists("developmentEnvironmentUserName")
|
checkPropertyExists("developmentEnvironmentUserName")
|
||||||
|
|
||||||
//Properties added in fork
|
//Properties added in fork
|
||||||
checkPropertyExists("skipBuildScriptUpdateCheck")
|
propertyDefaultIfUnset("skipBuildScriptUpdateCheck", false)
|
||||||
checkPropertyExists("repositoryURL")
|
propertyDefaultIfUnset("repositoryURL", "")
|
||||||
checkPropertyExists("repositoryName")
|
propertyDefaultIfUnset("repositoryName", "")
|
||||||
checkPropertyExists("mavenGroupId")
|
propertyDefaultIfUnset("mavenGroupId", "")
|
||||||
checkPropertyExists("mavenArtifactId")
|
propertyDefaultIfUnset("mavenArtifactId", "")
|
||||||
checkPropertyExists("hasMixinDeps")
|
propertyDefaultIfUnset("hasMixinDeps", false)
|
||||||
checkPropertyExists("mixinPreinitConfig")
|
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 javaSourceDir = "src/main/java/"
|
||||||
String scalaSourceDir = "src/main/scala/"
|
String scalaSourceDir = "src/main/scala/"
|
||||||
|
String kotlinSourceDir = "src/main/kotlin/"
|
||||||
|
|
||||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
||||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
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) {
|
if(apiPackage) {
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
||||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
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) {
|
if(accessTransformersFile) {
|
||||||
String targetFile = "src/main/resources/META-INF/" + 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)
|
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("\\.", "/")
|
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/")
|
||||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
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 targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala"
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java"
|
||||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt"
|
||||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
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 targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||||
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala"
|
||||||
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java"
|
||||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt"
|
||||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
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
|
// 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 {
|
try {
|
||||||
version = gitVersion()
|
'git config core.fileMode false'.execute()
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception ignored) {
|
||||||
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
|
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
|
group = modGroup
|
||||||
@@ -190,7 +245,7 @@ minecraft {
|
|||||||
replace gradleTokenModName, modName
|
replace gradleTokenModName, modName
|
||||||
}
|
}
|
||||||
if(gradleTokenVersion) {
|
if(gradleTokenVersion) {
|
||||||
replace gradleTokenVersion, versionDetails().lastTag
|
replace gradleTokenVersion, modVersion
|
||||||
}
|
}
|
||||||
if(gradleTokenGroupName) {
|
if(gradleTokenGroupName) {
|
||||||
replace gradleTokenGroupName, modGroup
|
replace gradleTokenGroupName, modGroup
|
||||||
@@ -231,9 +286,9 @@ dependencies {
|
|||||||
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3")
|
||||||
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
annotationProcessor("com.google.guava:guava:24.1.1-jre")
|
||||||
annotationProcessor("com.google.code.gson:gson:2.8.6")
|
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
|
// 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
|
// Mixin includes a lot of dependencies that are too up-to-date
|
||||||
exclude module: "launchwrapper"
|
exclude module: "launchwrapper"
|
||||||
exclude module: "guava"
|
exclude module: "guava"
|
||||||
@@ -244,7 +299,7 @@ dependencies {
|
|||||||
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
|
||||||
}
|
}
|
||||||
if(hasMixinDeps.toBoolean()) {
|
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
|
// Mixin includes a lot of dependencies that are too up-to-date
|
||||||
exclude module: "launchwrapper"
|
exclude module: "launchwrapper"
|
||||||
exclude module: "guava"
|
exclude module: "guava"
|
||||||
@@ -284,6 +339,9 @@ task relocateShadowJar(type: ConfigureShadowRelocation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
if (remapStubs.toBoolean()) {
|
||||||
|
dependsOn(removeStub)
|
||||||
|
}
|
||||||
project.configurations.shadeCompile.each { dep ->
|
project.configurations.shadeCompile.each { dep ->
|
||||||
from(project.zipTree(dep)) {
|
from(project.zipTree(dep)) {
|
||||||
exclude 'META-INF', 'META-INF/**'
|
exclude 'META-INF', 'META-INF/**'
|
||||||
@@ -300,6 +358,9 @@ shadowJar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
if (remapStubs.toBoolean()) {
|
||||||
|
dependsOn(removeStub)
|
||||||
|
}
|
||||||
project.configurations.shadeCompile.each { dep ->
|
project.configurations.shadeCompile.each { dep ->
|
||||||
from(project.zipTree(dep)) {
|
from(project.zipTree(dep)) {
|
||||||
exclude 'META-INF', 'META-INF/**'
|
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.
|
// this will ensure that this task is redone when the versions change.
|
||||||
inputs.property "version", project.version
|
inputs.property "version", project.version
|
||||||
inputs.property "mcversion", project.minecraft.version
|
inputs.property "mcversion", project.minecraft.version
|
||||||
@@ -408,9 +468,9 @@ processResources
|
|||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
include 'mcmod.info'
|
include 'mcmod.info'
|
||||||
|
|
||||||
// replace version and mcversion
|
// replace modVersion and minecraftVersion
|
||||||
expand "minecraftVersion": project.minecraft.version,
|
expand "minecraftVersion": project.minecraft.version,
|
||||||
"modVersion": versionDetails().lastTag,
|
"modVersion": modVersion,
|
||||||
"modId": modId,
|
"modId": modId,
|
||||||
"modName": modName
|
"modName": modName
|
||||||
}
|
}
|
||||||
@@ -419,7 +479,7 @@ processResources
|
|||||||
from refMap
|
from refMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
// copy everything else that's not the mcmod.info
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
exclude 'mcmod.info'
|
exclude 'mcmod.info'
|
||||||
}
|
}
|
||||||
@@ -427,7 +487,7 @@ processResources
|
|||||||
|
|
||||||
def getManifestAttributes() {
|
def getManifestAttributes() {
|
||||||
def manifestAttributes = [:]
|
def manifestAttributes = [:]
|
||||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) {
|
if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
|
||||||
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
manifestAttributes += ["FMLCorePluginContainsFMLMod": true]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -443,19 +503,22 @@ def getManifestAttributes() {
|
|||||||
manifestAttributes += [
|
manifestAttributes += [
|
||||||
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
"TweakClass" : "org.spongepowered.asm.launch.MixinTweaker",
|
||||||
"MixinConfigs" : "mixins." + modId + ".json" + (mixinPreinitConfig ? "," + mixinPreinitConfig : ""),
|
"MixinConfigs" : "mixins." + modId + ".json" + (mixinPreinitConfig ? "," + mixinPreinitConfig : ""),
|
||||||
"ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false
|
"ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean()
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
return manifestAttributes
|
return manifestAttributes
|
||||||
}
|
}
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
from (sourceSets.main.allJava)
|
from (sourceSets.main.allSource)
|
||||||
from (file("$projectDir/LICENSE"))
|
from (file("$projectDir/LICENSE"))
|
||||||
getArchiveClassifier().set('sources')
|
getArchiveClassifier().set('sources')
|
||||||
}
|
}
|
||||||
|
|
||||||
task shadowDevJar(type: ShadowJar) {
|
task shadowDevJar(type: ShadowJar) {
|
||||||
|
if (remapStubs.toBoolean()) {
|
||||||
|
dependsOn(removeStub)
|
||||||
|
}
|
||||||
project.configurations.shadeCompile.each { dep ->
|
project.configurations.shadeCompile.each { dep ->
|
||||||
from(project.zipTree(dep)) {
|
from(project.zipTree(dep)) {
|
||||||
exclude 'META-INF', 'META-INF/**'
|
exclude 'META-INF', 'META-INF/**'
|
||||||
@@ -485,6 +548,9 @@ task circularResolverJar(type: Jar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task devJar(type: Jar) {
|
task devJar(type: Jar) {
|
||||||
|
if (remapStubs.toBoolean()) {
|
||||||
|
dependsOn(removeStub)
|
||||||
|
}
|
||||||
project.configurations.shadeCompile.each { dep ->
|
project.configurations.shadeCompile.each { dep ->
|
||||||
from(project.zipTree(dep)) {
|
from(project.zipTree(dep)) {
|
||||||
exclude 'META-INF', 'META-INF/**'
|
exclude 'META-INF', 'META-INF/**'
|
||||||
@@ -505,7 +571,7 @@ task devJar(type: Jar) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task apiJar(type: Jar) {
|
task apiJar(type: Jar) {
|
||||||
from (sourceSets.main.allJava) {
|
from (sourceSets.main.allSource) {
|
||||||
include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**'
|
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
|
// publishing
|
||||||
|
|
||||||
def getMavenSettingsCredentials = {
|
def getMavenSettingsCredentials = {
|
||||||
@@ -539,23 +614,20 @@ def getMavenSettingsCredentials = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def getCredentials = {
|
def getCredentials = {
|
||||||
try {
|
String username = System.getenv("MAVEN_DEPLOY_USER")
|
||||||
def entries = getMavenSettingsCredentials()
|
String password = System.getenv("MAVEN_DEPLOY_PASSWORD")
|
||||||
for (entry in entries) {
|
if (username == null) {
|
||||||
if (entry."id".text() == repositoryName) {
|
try {
|
||||||
return [username: entry.username.text(), password: entry.password.text()]
|
def entries = getMavenSettingsCredentials()
|
||||||
|
for (entry in entries) {
|
||||||
|
if (entry."id".text() == repositoryName) {
|
||||||
|
return [username: entry.username.text(), password: entry.password.text()]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ignored){}
|
||||||
throw new Exception();
|
return [username: "none", password: "none"]
|
||||||
} catch (Exception ignored) {
|
} else {
|
||||||
//Try from environment variables if file does not exist
|
return [username: username, password: password]
|
||||||
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]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,9 +635,12 @@ def getCredentials = {
|
|||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
maven(MavenPublication) {
|
maven(MavenPublication) {
|
||||||
artifact source: (jar.enabled ? jar : shadowJar)
|
from components.java
|
||||||
artifact source: sourcesJar, classifier: "src"
|
if(usesShadowedDependencies.toBoolean()) {
|
||||||
artifact source: (devJar.enabled ? devJar : shadowDevJar), classifier: "dev"
|
artifact source: shadowJar, classifier: ""
|
||||||
|
}
|
||||||
|
artifact source: sourcesJar, classifier: "sources"
|
||||||
|
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||||
if (apiPackage) {
|
if (apiPackage) {
|
||||||
artifact source: apiJar, classifier: "api"
|
artifact source: apiJar, classifier: "api"
|
||||||
}
|
}
|
||||||
@@ -573,6 +648,25 @@ publishing {
|
|||||||
groupId = mavenGroupId
|
groupId = mavenGroupId
|
||||||
artifactId = mavenArtifactId + "-mc" + minecraftVersion
|
artifactId = mavenArtifactId + "-mc" + minecraftVersion
|
||||||
version = gitVersion()
|
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
|
url = repositoryURL
|
||||||
def creds = getCredentials()
|
def creds = getCredentials()
|
||||||
credentials {
|
credentials {
|
||||||
username = creds == null ? "none" : creds.username
|
username = creds?.username ?: "none"
|
||||||
password = creds == null ? "none" : creds.password
|
password = creds?.password ?: "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -604,7 +698,7 @@ if (!skipBuildScriptUpdateCheck.toBoolean() && isNewBuildScriptVersionAvailable(
|
|||||||
if (autoUpdateBuildScript.toBoolean()) {
|
if (autoUpdateBuildScript.toBoolean()) {
|
||||||
performBuildScriptUpdate(projectDir.toString())
|
performBuildScriptUpdate(projectDir.toString())
|
||||||
} else {
|
} 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)) {
|
if (isNewBuildScriptVersionAvailable(projectDir)) {
|
||||||
def buildscriptFile = getFile("build.gradle")
|
def buildscriptFile = getFile("build.gradle")
|
||||||
availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } }
|
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 true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@@ -647,14 +741,246 @@ configure(updateBuildScript) {
|
|||||||
description = 'Updates the build script to the latest version'
|
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
|
// Helper methods
|
||||||
|
|
||||||
def checkPropertyExists(String propertyName) {
|
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")
|
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) {
|
def getFile(String relativePath) {
|
||||||
return new File(projectDir, relativePath)
|
return new File(projectDir, relativePath)
|
||||||
}
|
}
|
||||||
+21
-19
@@ -4,25 +4,27 @@ dependencies {
|
|||||||
}
|
}
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.22")
|
annotationProcessor("org.projectlombok:lombok:1.18.22")
|
||||||
|
|
||||||
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.8.2:dev")
|
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.9.2:dev")
|
||||||
|
|
||||||
compileOnly("curse.maven:undergroundbiomesconstructs-72744:2304497") {
|
String curseMaven = "https://cursemaven.falsepattern.com/" //Use https://cursemaven.com/ if this is down
|
||||||
transitive = false
|
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
|
||||||
|
compile("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") {
|
compile(deobfMaven(curseMaven, "curse.maven:antiidconflict-246288:2308279")) // 1.3.5
|
||||||
transitive = false
|
compile("curse.maven:atg-228356:2231155") // 0.12.0
|
||||||
}
|
compile(deobfMaven(curseMaven, "curse.maven:biomesoplenty-220318:2499612")) // 2.1.0.2308
|
||||||
|
compile(deobfMaven(curseMaven, "curse.maven:rtg-237989:2521557")) // 1.1.1.7
|
||||||
compileOnly("curse.maven:worldedit-225608:2309699") {
|
compile(deobfMaven(curseMaven, "curse.maven:naturescompass-252848:2451823")) // 1.3.1
|
||||||
transitive = false
|
compile(deobfMaven(curseMaven, "curse.maven:dynamicsurrounding-238891:2642381")) // 1.0.6.4
|
||||||
}
|
compile(deobfMaven(curseMaven, "curse.maven:immersivecavegen-521557:3649411")) // 1.2g
|
||||||
|
compile(deobfMaven(curseMaven, "curse.maven:twilightforest-227639:3039937")) // 2.3.8
|
||||||
compileOnly("curse.maven:cofh-lib-220333:2388747") {
|
compile(deobfMaven(curseMaven, "curse.maven:thaumcraft-223628:2227552")) // 4.2.3.5
|
||||||
transitive = false
|
compile(deobfMaven(curseMaven, "curse.maven:baubles-227083:2224857")) // 1.0.1.10, dependency of thaumcraft
|
||||||
}
|
compile(deobfMaven(curseMaven, "curse.maven:antiqueatlas-227795:2454232")) // 4.4.4
|
||||||
|
compile("curse.maven:extrautilities-225561:2264384") // 1.2.12
|
||||||
compileOnly("curse.maven:dragonapi-235591:3574508") {
|
compile("com.github.embeddedt:ArchaicFix:be8666cb2dbf2e0a8b799e88cef3c0d12e5d4911:dev")
|
||||||
transitive = false
|
compileOnly(deobf("https://micdoodle8.com/new-builds/GC-1.7/504/GalacticraftCore-1.7-3.0.12.504.jar"))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -82,6 +82,12 @@ containsMixinsAndOrCoreModOnly = false
|
|||||||
# responsibility check the licence and request permission for distribution, if required.
|
# responsibility check the licence and request permission for distribution, if required.
|
||||||
usesShadowedDependencies = false
|
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 = true
|
||||||
|
|
||||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||||
# projects. New projects should not use this parameter.
|
# projects. New projects should not use this parameter.
|
||||||
#customArchiveBaseName =
|
#customArchiveBaseName =
|
||||||
@@ -12,4 +12,8 @@ repositories {
|
|||||||
name = "mavenpattern"
|
name = "mavenpattern"
|
||||||
url = "https://maven.falsepattern.com/"
|
url = "https://maven.falsepattern.com/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name = "jitpack"
|
||||||
|
url = "https://jitpack.falsepattern.com/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,31 @@
|
|||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.managers.BiomesManager;
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.Mod;
|
import cpw.mods.fml.common.Mod;
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
@Mod(modid = Tags.MODID,
|
@Mod(modid = Tags.MODID,
|
||||||
version = Tags.VERSION,
|
version = Tags.VERSION,
|
||||||
name = Tags.MODNAME,
|
name = Tags.MODNAME,
|
||||||
acceptedMinecraftVersions = "[1.7.10]",
|
acceptedMinecraftVersions = "[1.7.10]",
|
||||||
dependencies = "required-after:falsepatternlib@[0.8.2,);")
|
dependencies = "required-after:falsepatternlib@[0.9.2,);after:antiidconflict")
|
||||||
public class EndlessIDs {}
|
public class EndlessIDs {
|
||||||
|
public static final byte[] BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
||||||
|
public static final Logger LOG = LogManager.getLogger(Tags.MODNAME);
|
||||||
|
|
||||||
|
private static void antiIdConflictLatePatch() {
|
||||||
|
BiomesManager.conflicts = new BiomesManager.ConflictingBiomes[ExtendedConstants.biomeIDCount];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mod.EventHandler
|
||||||
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
|
if (Loader.isModLoaded("antiidconflict")) {
|
||||||
|
antiIdConflictLatePatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,17 @@
|
|||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import java.nio.ShortBuffer;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ShortBuffer;
|
||||||
|
|
||||||
public class Hooks {
|
public class Hooks {
|
||||||
|
|
||||||
@@ -19,7 +23,7 @@ public class Hooks {
|
|||||||
System.arraycopy(msb, 0, ret, lsb.length * 2, lsb.length);
|
System.arraycopy(msb, 0, ret, lsb.length * 2, lsb.length);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setBlockData(final IExtendedBlockStorageMixin ebs, final byte[] data, final int offset) {
|
public static void setBlockData(final IExtendedBlockStorageMixin ebs, final byte[] data, final int offset) {
|
||||||
val lsb = ebs.getLSB();
|
val lsb = ebs.getLSB();
|
||||||
val msb = ebs.getMSB();
|
val msb = ebs.getMSB();
|
||||||
@@ -44,9 +48,11 @@ public class Hooks {
|
|||||||
byte3Data[i] = ebsMSB[i];
|
byte3Data[i] = ebsMSB[i];
|
||||||
}
|
}
|
||||||
val idLSB = (ebsLSB[i] & 0xFFFF);
|
val idLSB = (ebsLSB[i] & 0xFFFF);
|
||||||
byte1Data[i] = (byte)(idLSB & 0xFF);
|
byte1Data[i] = (byte) (idLSB & 0xFF);
|
||||||
|
|
||||||
if (idLSB <= 0xFF) continue;
|
if (idLSB <= 0xFF) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
val nibbleIndex = i >> 1;
|
val nibbleIndex = i >> 1;
|
||||||
val nibbleShift = (i & 1) * 4;
|
val nibbleShift = (i & 1) * 4;
|
||||||
if (byte2BottomNibbleData == null) {
|
if (byte2BottomNibbleData == null) {
|
||||||
@@ -54,7 +60,9 @@ public class Hooks {
|
|||||||
}
|
}
|
||||||
byte2BottomNibbleData[nibbleIndex] |= ((idLSB >>> 8) & 0xF) << nibbleShift;
|
byte2BottomNibbleData[nibbleIndex] |= ((idLSB >>> 8) & 0xF) << nibbleShift;
|
||||||
|
|
||||||
if (idLSB <= 0xFFF) continue;
|
if (idLSB <= 0xFFF) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (byte2TopNibbleData == null) {
|
if (byte2TopNibbleData == null) {
|
||||||
byte2TopNibbleData = new byte[ebsLSB.length / 2];
|
byte2TopNibbleData = new byte[ebsLSB.length / 2];
|
||||||
}
|
}
|
||||||
@@ -62,12 +70,15 @@ public class Hooks {
|
|||||||
|
|
||||||
}
|
}
|
||||||
nbt.setByteArray("Blocks", byte1Data);
|
nbt.setByteArray("Blocks", byte1Data);
|
||||||
if (byte2BottomNibbleData != null)
|
if (byte2BottomNibbleData != null) {
|
||||||
nbt.setByteArray("Add", byte2BottomNibbleData);
|
nbt.setByteArray("Add", byte2BottomNibbleData);
|
||||||
if (byte2TopNibbleData != null)
|
}
|
||||||
|
if (byte2TopNibbleData != null) {
|
||||||
nbt.setByteArray("BlocksB2Hi", byte2TopNibbleData);
|
nbt.setByteArray("BlocksB2Hi", byte2TopNibbleData);
|
||||||
if (byte3Data != null)
|
}
|
||||||
|
if (byte3Data != null) {
|
||||||
nbt.setByteArray("BlocksB3", byte3Data);
|
nbt.setByteArray("BlocksB3", byte3Data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
||||||
@@ -91,7 +102,7 @@ public class Hooks {
|
|||||||
if (byte2TopNibbleData != null) {
|
if (byte2TopNibbleData != null) {
|
||||||
id |= ((byte2TopNibbleData[i >> 1] >> nibbleShift) & 0xF) << 12;
|
id |= ((byte2TopNibbleData[i >> 1] >> nibbleShift) & 0xF) << 12;
|
||||||
}
|
}
|
||||||
lsb[i] = (short)id;
|
lsb[i] = (short) id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,15 +112,15 @@ public class Hooks {
|
|||||||
int cntNonEmpty = 0;
|
int cntNonEmpty = 0;
|
||||||
int cntTicking = 0;
|
int cntTicking = 0;
|
||||||
for (int off = 0; off < blkIdsLSB.length; ++off) {
|
for (int off = 0; off < blkIdsLSB.length; ++off) {
|
||||||
final int id = ((blkIdsLSB[off] & 0xFFFF) | ((blkIdsMSB[off] & 0xFF) << 16)) & ExtendedConstants.blockIDMask;
|
final int id =
|
||||||
|
((blkIdsLSB[off] & 0xFFFF) | ((blkIdsMSB[off] & 0xFF) << 16)) & ExtendedConstants.blockIDMask;
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
final Block block = (Block)Block.blockRegistry.getObjectById(id);
|
final Block block = (Block) Block.blockRegistry.getObjectById(id);
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
if (IEConfig.removeInvalidBlocks) {
|
if (IEConfig.removeInvalidBlocks) {
|
||||||
blkIdsLSB[off] = 0;
|
blkIdsLSB[off] = 0;
|
||||||
}
|
}
|
||||||
}
|
} else if (block != Blocks.air) {
|
||||||
else if (block != Blocks.air) {
|
|
||||||
++cntNonEmpty;
|
++cntNonEmpty;
|
||||||
if (block.getTickRandomly()) {
|
if (block.getTickRandomly()) {
|
||||||
++cntTicking;
|
++cntTicking;
|
||||||
@@ -120,11 +131,12 @@ public class Hooks {
|
|||||||
ebs.setBlockRefCount(cntNonEmpty);
|
ebs.setBlockRefCount(cntNonEmpty);
|
||||||
ebs.setTickRefCount(cntTicking);
|
ebs.setTickRefCount(cntTicking);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getIdFromBlockWithCheck(final Block block, final Block oldBlock) {
|
public static int getIdFromBlockWithCheck(final Block block, final Block oldBlock) {
|
||||||
final int id = Block.getIdFromBlock(block);
|
final int id = Block.getIdFromBlock(block);
|
||||||
if (IEConfig.catchUnregisteredBlocks && id == -1) {
|
if (IEConfig.catchUnregisteredBlocks && id == -1) {
|
||||||
throw new IllegalArgumentException("Block " + block + " is not registered. <-- Say about this to the author of this mod, or you can try to enable \"RemoveInvalidBlocks\" option in EID config.");
|
throw new IllegalArgumentException("Block " + block +
|
||||||
|
" is not registered. <-- Say about this to the author of this mod, or you can try to enable \"RemoveInvalidBlocks\" option in EID config.");
|
||||||
}
|
}
|
||||||
if (id >= 0 && id <= ExtendedConstants.maxBlockID) {
|
if (id >= 0 && id <= ExtendedConstants.maxBlockID) {
|
||||||
return id;
|
return id;
|
||||||
@@ -134,5 +146,66 @@ public class Hooks {
|
|||||||
}
|
}
|
||||||
throw new IllegalArgumentException("id out of range: " + id);
|
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) & 255);
|
||||||
|
}
|
||||||
|
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) & 255) | (byteArray[i] & 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -12,11 +12,13 @@ public class IEConfig {
|
|||||||
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.")
|
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.")
|
||||||
public static boolean extendDataWatcher = false;
|
public static boolean extendDataWatcher = false;
|
||||||
|
|
||||||
@Config.Comment("Setting this value greater than 0 will reduce RAM usage, at the cost of less available Block IDs.\n" +
|
@Config.Comment(
|
||||||
"Notice: This does not affect ITEM IDs.\n" +
|
"Setting this value greater than 0 will reduce RAM usage, at the cost of less available Block IDs.\n" +
|
||||||
"By default, block IDs can also go up to 16 Million, and each additional bit in this setting halves\n" +
|
"Notice: This does not affect ITEM IDs.\n" +
|
||||||
"this value.\n" +
|
"By default, block IDs can also go up to 16 Million, and each additional bit in this setting halves\n" +
|
||||||
"(0: 16M, 1: 8M, 2: 4M, 3: 2M, 4: 1M, 5: 512K, 6: 256K, 7: 128K, 8: 64K, 9: 32K, 10: 16K, 11: 8K, 12: 4K)\n")
|
"this value.\n" +
|
||||||
@Config.RangeInt(min = 0, max = 12)
|
"(0: 16M, 1: 8M, 2: 4M, 3: 2M, 4: 1M, 5: 512K, 6: 256K, 7: 128K, 8: 64K, 9: 32K, 10: 16K, 11: 8K, 12: 4K)\n")
|
||||||
|
@Config.RangeInt(min = 0,
|
||||||
|
max = 12)
|
||||||
public static int countCorrectionBits = 0;
|
public static int countCorrectionBits = 0;
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,27 @@
|
|||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
import com.falsepattern.endlessids.asm.IETransformer;
|
||||||
import com.falsepattern.lib.config.ConfigException;
|
import com.falsepattern.lib.config.ConfigException;
|
||||||
import com.falsepattern.lib.config.ConfigurationManager;
|
import com.falsepattern.lib.config.ConfigurationManager;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||||
|
|
||||||
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.*;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.DependsOn;
|
||||||
|
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.MCVersion;
|
||||||
|
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.Name;
|
||||||
|
import static cpw.mods.fml.relauncher.IFMLLoadingPlugin.TransformerExclusions;
|
||||||
|
|
||||||
@MCVersion("1.7.10")
|
@MCVersion("1.7.10")
|
||||||
@Name(Tags.MODID)
|
@Name(Tags.MODID)
|
||||||
@TransformerExclusions({ "com.falsepattern.endlessids.asm" })
|
@TransformerExclusions({"com.falsepattern.endlessids.asm"})
|
||||||
@DependsOn("falsepatternlib")
|
@DependsOn("falsepatternlib")
|
||||||
public class IEPlugin implements IFMLLoadingPlugin
|
public class IEPlugin implements IFMLLoadingPlugin {
|
||||||
{
|
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
ConfigurationManager.registerConfig(IEConfig.class);
|
ConfigurationManager.registerConfig(IEConfig.class);
|
||||||
@@ -22,26 +29,39 @@ public class IEPlugin implements IFMLLoadingPlugin
|
|||||||
System.err.println("Failed to load EndlessIDs config. Using defaults.");
|
System.err.println("Failed to load EndlessIDs config. Using defaults.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEPlugin() {
|
public IEPlugin() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
public String[] getASMTransformerClass() {
|
public String[] getASMTransformerClass() {
|
||||||
return new String[] { IETransformer.class.getName() };
|
val cl = ((LaunchClassLoader) this.getClass().getClassLoader());
|
||||||
|
val field = cl.getClass().getDeclaredField("transformerExceptions");
|
||||||
|
field.setAccessible(true);
|
||||||
|
val exceptions = (Set<String>) field.get(cl);
|
||||||
|
if (exceptions.contains("code.elix_x.coremods")) {
|
||||||
|
IETransformer.logger.info("AntiIDConflict detected!");
|
||||||
|
IETransformer.logger.info("Removing ASM protections so that we can fix its code.");
|
||||||
|
exceptions.remove("code.elix_x.coremods");
|
||||||
|
exceptions.add("code.elix_x.coremods.antiidconflict.core");
|
||||||
|
exceptions.add("code.elix_x.coremods.antiidconflict.ByteCodeTester");
|
||||||
|
}
|
||||||
|
return new String[]{IETransformer.class.getName()};
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModContainerClass() {
|
public String getModContainerClass() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSetupClass() {
|
public String getSetupClass() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void injectData(final Map<String, Object> data) {
|
public void injectData(final Map<String, Object> data) {
|
||||||
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
|
IETransformer.isObfuscated = (Boolean) data.get("runtimeDeobfuscationEnabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccessTransformerClass() {
|
public String getAccessTransformerClass() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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() + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
|
import Reika.DragonAPI.Libraries.Java.ReikaJavaLibrary;
|
||||||
|
import com.falsepattern.endlessids.asm.stubpackage.Reika.DragonAPI.ModList;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
|
||||||
|
public class ASMHooks {
|
||||||
|
@SneakyThrows
|
||||||
|
public static void DragonAPIModListConstructorTweak(ModList list) {
|
||||||
|
list.successful = false;
|
||||||
|
DragonAPIModListTryLoad(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean DragonAPIModListTryLoad(ModList list) {
|
||||||
|
if (!list.successful) {
|
||||||
|
try {
|
||||||
|
list.condition = Loader.isModLoaded(list.modLabel);
|
||||||
|
list.successful = true;
|
||||||
|
if (list.condition) {
|
||||||
|
ReikaJavaLibrary.pConsole(
|
||||||
|
"DRAGONAPI: " + list + " detected in the MC installation. Adjusting behavior accordingly.");
|
||||||
|
} else {
|
||||||
|
ReikaJavaLibrary.pConsole(
|
||||||
|
"DRAGONAPI: " + list + " not detected in the MC installation. No special action taken.");
|
||||||
|
}
|
||||||
|
if (list.condition) {
|
||||||
|
ReikaJavaLibrary.pConsole("DRAGONAPI: Attempting to load data from " + list);
|
||||||
|
if (list.blockClasses == null) {
|
||||||
|
ReikaJavaLibrary.pConsole("DRAGONAPI: Could not block class for " + list +
|
||||||
|
": Specified class was null. This may not be an error.");
|
||||||
|
}
|
||||||
|
if (list.itemClasses == null) {
|
||||||
|
ReikaJavaLibrary.pConsole("DRAGONAPI: Could not item class for " + list +
|
||||||
|
": Specified class was null. This may not be an error.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
list.condition = list.successful = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list.condition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DragonAPIModListSuppressLogging(Object obj) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +1,16 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
public class AsmTransformException extends RuntimeException
|
public class AsmTransformException extends RuntimeException {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 5128914670008752449L;
|
private static final long serialVersionUID = 5128914670008752449L;
|
||||||
|
|
||||||
public AsmTransformException(final String message) {
|
public AsmTransformException(final String message) {
|
||||||
super(message);
|
super(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsmTransformException(final Throwable cause) {
|
public AsmTransformException(final Throwable cause) {
|
||||||
super(cause);
|
super(cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsmTransformException(final String message, final Throwable cause) {
|
public AsmTransformException(final String message, final Throwable cause) {
|
||||||
super(message, cause);
|
super(message, cause);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,20 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||||
import org.objectweb.asm.MethodVisitor;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import org.objectweb.asm.util.Printer;
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
import org.objectweb.asm.util.TraceMethodVisitor;
|
|
||||||
import org.objectweb.asm.util.Textifier;
|
|
||||||
import org.objectweb.asm.tree.InsnList;
|
|
||||||
import java.util.ListIterator;
|
|
||||||
import org.objectweb.asm.tree.InsnNode;
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
import org.objectweb.asm.tree.IntInsnNode;
|
import org.objectweb.asm.tree.IntInsnNode;
|
||||||
import org.objectweb.asm.tree.LdcInsnNode;
|
import org.objectweb.asm.tree.LdcInsnNode;
|
||||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
|
|
||||||
public class AsmUtil
|
import java.util.ListIterator;
|
||||||
{
|
|
||||||
|
public class AsmUtil {
|
||||||
public AsmUtil() {
|
public AsmUtil() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FieldNode findField(final ClassNode cn, final String name, final boolean optional) {
|
public static FieldNode findField(final ClassNode cn, final String name, final boolean optional) {
|
||||||
for (final FieldNode ret : cn.fields) {
|
for (final FieldNode ret : cn.fields) {
|
||||||
if (name.equals(ret.name)) {
|
if (name.equals(ret.name)) {
|
||||||
@@ -32,7 +26,7 @@ public class AsmUtil
|
|||||||
}
|
}
|
||||||
throw new FieldNotFoundException(name);
|
throw new FieldNotFoundException(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean transformInlinedSizeMethod(final ClassNode cn, final MethodNode method, final int oldValue, final int newValue, final boolean optional) {
|
public static boolean transformInlinedSizeMethod(final ClassNode cn, final MethodNode method, final int oldValue, final int newValue, final boolean optional) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
boolean foundOnce = false;
|
boolean foundOnce = false;
|
||||||
@@ -42,30 +36,23 @@ public class AsmUtil
|
|||||||
final AbstractInsnNode insn = it.next();
|
final AbstractInsnNode insn = it.next();
|
||||||
if (insn.getOpcode() == 3 && oldValue == 0) {
|
if (insn.getOpcode() == 3 && oldValue == 0) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
} else if (insn.getOpcode() == 4 && oldValue == 1) {
|
||||||
else if (insn.getOpcode() == 4 && oldValue == 1) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
} else if (insn.getOpcode() == 5 && oldValue == 2) {
|
||||||
else if (insn.getOpcode() == 5 && oldValue == 2) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
} else if (insn.getOpcode() == 6 && oldValue == 3) {
|
||||||
else if (insn.getOpcode() == 6 && oldValue == 3) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
} else if (insn.getOpcode() == 7 && oldValue == 4) {
|
||||||
else if (insn.getOpcode() == 7 && oldValue == 4) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
} else if (insn.getOpcode() == 8 && oldValue == 5) {
|
||||||
else if (insn.getOpcode() == 8 && oldValue == 5) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
} else if (insn.getOpcode() == 18) {
|
||||||
else if (insn.getOpcode() == 18) {
|
final LdcInsnNode node = (LdcInsnNode) insn;
|
||||||
final LdcInsnNode node = (LdcInsnNode)insn;
|
if (node.cst instanceof Integer && (int) node.cst == oldValue) {
|
||||||
if (node.cst instanceof Integer && (int)node.cst == oldValue) {
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
} else if (insn.getOpcode() == 17 || insn.getOpcode() == 16) {
|
||||||
else if (insn.getOpcode() == 17 || insn.getOpcode() == 16) {
|
final IntInsnNode node2 = (IntInsnNode) insn;
|
||||||
final IntInsnNode node2 = (IntInsnNode)insn;
|
|
||||||
if (node2.operand == oldValue) {
|
if (node2.operand == oldValue) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@@ -74,29 +61,21 @@ public class AsmUtil
|
|||||||
foundOnce = true;
|
foundOnce = true;
|
||||||
if (newValue == 0) {
|
if (newValue == 0) {
|
||||||
it.set(new InsnNode(3));
|
it.set(new InsnNode(3));
|
||||||
}
|
} else if (newValue == 1) {
|
||||||
else if (newValue == 1) {
|
|
||||||
it.set(new InsnNode(4));
|
it.set(new InsnNode(4));
|
||||||
}
|
} else if (newValue == 2) {
|
||||||
else if (newValue == 2) {
|
|
||||||
it.set(new InsnNode(5));
|
it.set(new InsnNode(5));
|
||||||
}
|
} else if (newValue == 3) {
|
||||||
else if (newValue == 3) {
|
|
||||||
it.set(new InsnNode(6));
|
it.set(new InsnNode(6));
|
||||||
}
|
} else if (newValue == 4) {
|
||||||
else if (newValue == 4) {
|
|
||||||
it.set(new InsnNode(7));
|
it.set(new InsnNode(7));
|
||||||
}
|
} else if (newValue == 5) {
|
||||||
else if (newValue == 5) {
|
|
||||||
it.set(new InsnNode(8));
|
it.set(new InsnNode(8));
|
||||||
}
|
} else if (newValue >= -128 && newValue <= 127) {
|
||||||
else if (newValue >= -128 && newValue <= 127) {
|
|
||||||
it.set(new IntInsnNode(16, newValue));
|
it.set(new IntInsnNode(16, newValue));
|
||||||
}
|
} else if (newValue >= -32768 && newValue <= 32767) {
|
||||||
else if (newValue >= -32768 && newValue <= 32767) {
|
|
||||||
it.set(new IntInsnNode(17, newValue));
|
it.set(new IntInsnNode(17, newValue));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
it.set(new LdcInsnNode(newValue));
|
it.set(new LdcInsnNode(newValue));
|
||||||
}
|
}
|
||||||
found = false;
|
found = false;
|
||||||
@@ -107,5 +86,5 @@ public class AsmUtil
|
|||||||
}
|
}
|
||||||
return foundOnce;
|
return foundOnce;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,18 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import com.falsepattern.endlessids.asm.transformer.DragonAPIModList;
|
||||||
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum ClassEdit
|
public enum ClassEdit {
|
||||||
{
|
FmlRegistry(new FmlRegistry(), new String[]{"cpw.mods.fml.common.registry.GameData",
|
||||||
FmlRegistry(new FmlRegistry(), new String[] { "cpw.mods.fml.common.registry.GameData", "cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry" }),
|
"cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry"}),
|
||||||
;
|
DragonAPIModList(new DragonAPIModList(), new String[]{"Reika.DragonAPI.ModList"});
|
||||||
|
|
||||||
private static final Map<String, ClassEdit> editMap;
|
private static final Map<String, ClassEdit> editMap;
|
||||||
private final IClassNodeTransformer transformer;
|
|
||||||
private final String[] classNames;
|
|
||||||
|
|
||||||
ClassEdit(final IClassNodeTransformer transformer, final String[] classNames) {
|
|
||||||
this.transformer = transformer;
|
|
||||||
this.classNames = classNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ClassEdit get(final String className) {
|
|
||||||
return ClassEdit.editMap.get(className);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IClassNodeTransformer getTransformer() {
|
|
||||||
return this.transformer;
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
editMap = new HashMap<>();
|
editMap = new HashMap<>();
|
||||||
for (final ClassEdit edit : values()) {
|
for (final ClassEdit edit : values()) {
|
||||||
@@ -38,4 +21,24 @@ public enum ClassEdit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final IClassNodeTransformer transformer;
|
||||||
|
private final String[] classNames;
|
||||||
|
|
||||||
|
ClassEdit(final IClassNodeTransformer transformer, final String[] classNames) {
|
||||||
|
this.transformer = transformer;
|
||||||
|
this.classNames = classNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ClassEdit get(final String className) {
|
||||||
|
return ClassEdit.editMap.get(className);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IClassNodeTransformer getTransformer() {
|
||||||
|
return this.transformer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
public class FieldNotFoundException extends AsmTransformException
|
public class FieldNotFoundException extends AsmTransformException {
|
||||||
{
|
|
||||||
public FieldNotFoundException(final String field) {
|
public FieldNotFoundException(final String field) {
|
||||||
super("can't find field " + field);
|
super("can't find field " + field);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.falsepattern.endlessids.asm;
|
|||||||
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
|
||||||
public interface IClassNodeTransformer
|
public interface IClassNodeTransformer {
|
||||||
{
|
|
||||||
void transform(final ClassNode p0, final boolean p1);
|
void transform(final ClassNode p0, final boolean p1);
|
||||||
}
|
}
|
||||||
@@ -2,23 +2,27 @@ package com.falsepattern.endlessids.asm;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.Tags;
|
import com.falsepattern.endlessids.Tags;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.objectweb.asm.util.CheckClassAdapter;
|
|
||||||
import org.objectweb.asm.ClassWriter;
|
|
||||||
import org.objectweb.asm.ClassVisitor;
|
|
||||||
import org.objectweb.asm.ClassReader;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.objectweb.asm.ClassReader;
|
||||||
|
import org.objectweb.asm.ClassVisitor;
|
||||||
|
import org.objectweb.asm.ClassWriter;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.util.CheckClassAdapter;
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.IClassTransformer;
|
import net.minecraft.launchwrapper.IClassTransformer;
|
||||||
|
|
||||||
public class IETransformer implements IClassTransformer
|
public class IETransformer implements IClassTransformer {
|
||||||
{
|
|
||||||
public static final Logger logger;
|
public static final Logger logger;
|
||||||
public static boolean isObfuscated;
|
public static boolean isObfuscated;
|
||||||
|
|
||||||
|
static {
|
||||||
|
logger = LogManager.getLogger(Tags.MODNAME + " ASM");
|
||||||
|
}
|
||||||
|
|
||||||
public IETransformer() {
|
public IETransformer() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] transform(final String name, final String transformedName, final byte[] bytes) {
|
public byte[] transform(final String name, final String transformedName, final byte[] bytes) {
|
||||||
if (bytes == null) {
|
if (bytes == null) {
|
||||||
return bytes;
|
return bytes;
|
||||||
@@ -33,29 +37,25 @@ public class IETransformer implements IClassTransformer
|
|||||||
reader.accept(cn, 0);
|
reader.accept(cn, 0);
|
||||||
try {
|
try {
|
||||||
edit.getTransformer().transform(cn, IETransformer.isObfuscated);
|
edit.getTransformer().transform(cn, IETransformer.isObfuscated);
|
||||||
}
|
} catch (AsmTransformException t) {
|
||||||
catch (AsmTransformException t) {
|
IETransformer.logger.error("Error transforming {} with {}: {}", transformedName, edit.getName(),
|
||||||
IETransformer.logger.error("Error transforming {} with {}: {}", transformedName, edit.getName(), t.getMessage());
|
t.getMessage());
|
||||||
throw t;
|
throw t;
|
||||||
}
|
} catch (Throwable t2) {
|
||||||
catch (Throwable t2) {
|
IETransformer.logger.error("Error transforming {} with {}: {}", transformedName, edit.getName(),
|
||||||
IETransformer.logger.error("Error transforming {} with {}: {}", transformedName, edit.getName(), t2.getMessage());
|
t2.getMessage());
|
||||||
throw new RuntimeException(t2);
|
throw new RuntimeException(t2);
|
||||||
}
|
}
|
||||||
final ClassWriter writer = new ClassWriter(0);
|
final ClassWriter writer = new ClassWriter(0);
|
||||||
try {
|
try {
|
||||||
final ClassVisitor check = new CheckClassAdapter(writer);
|
final ClassVisitor check = new CheckClassAdapter(writer);
|
||||||
cn.accept(check);
|
cn.accept(check);
|
||||||
}
|
} catch (Throwable t3) {
|
||||||
catch (Throwable t3) {
|
IETransformer.logger.error("Error verifying {} transformed with {}: {}", transformedName, edit.getName(),
|
||||||
IETransformer.logger.error("Error verifying {} transformed with {}: {}", transformedName, edit.getName(), t3.getMessage());
|
t3.getMessage());
|
||||||
throw new RuntimeException(t3);
|
throw new RuntimeException(t3);
|
||||||
}
|
}
|
||||||
IETransformer.logger.debug("Patched {} successfully.", edit.getName());
|
IETransformer.logger.debug("Patched {} successfully.", edit.getName());
|
||||||
return writer.toByteArray();
|
return writer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
logger = LogManager.getLogger(Tags.MODNAME + " ASM");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
public class MethodNotFoundException extends AsmTransformException
|
public class MethodNotFoundException extends AsmTransformException {
|
||||||
{
|
|
||||||
public MethodNotFoundException(final String method) {
|
public MethodNotFoundException(final String method) {
|
||||||
super("can't find method " + method);
|
super("can't find method " + method);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.falsepattern.endlessids.asm.stubpackage.Reika.DragonAPI;
|
||||||
|
|
||||||
|
public class ModList {
|
||||||
|
public String modLabel;
|
||||||
|
public boolean condition;
|
||||||
|
public boolean successful;
|
||||||
|
public String[] itemClasses;
|
||||||
|
public String[] blockClasses;
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.asm.ASMHooks;
|
||||||
|
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.Type;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.FieldInsnNode;
|
||||||
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
import org.objectweb.asm.tree.FrameNode;
|
||||||
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
|
import org.objectweb.asm.tree.LineNumberNode;
|
||||||
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DragonAPIModList implements IClassNodeTransformer {
|
||||||
|
private static final List<String> fields = Arrays.asList("condition", "itemClasses", "blockClasses");
|
||||||
|
|
||||||
|
private static void tweakIsLoaded(MethodNode method) {
|
||||||
|
val iterator = method.instructions.iterator();
|
||||||
|
iterator.next();
|
||||||
|
iterator.next();
|
||||||
|
iterator.next();
|
||||||
|
iterator.next();
|
||||||
|
iterator.set(new MethodInsnNode(Opcodes.INVOKESTATIC, Type.getInternalName(ASMHooks.class),
|
||||||
|
"DragonAPIModListTryLoad", "(LReika/DragonAPI/ModList;)Z", false));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void tweakInit(MethodNode method) {
|
||||||
|
val iterator = method.instructions.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
var insn = iterator.next();
|
||||||
|
if (insn instanceof LineNumberNode && ((LineNumberNode) insn).line == 154) {
|
||||||
|
//SRC:
|
||||||
|
// L3
|
||||||
|
// LINENUMBER 154 L3
|
||||||
|
// ALOAD 0
|
||||||
|
// ALOAD 0
|
||||||
|
// GETFIELD Reika/DragonAPI/ModList.modLabel : Ljava/lang/String;
|
||||||
|
// INVOKESTATIC cpw/mods/fml/common/Loader.isModLoaded (Ljava/lang/String;)Z
|
||||||
|
// PUTFIELD Reika/DragonAPI/ModList.condition : Z
|
||||||
|
//TGT:
|
||||||
|
// L3
|
||||||
|
// LINENUMBER 154 L3
|
||||||
|
// ALOAD 0
|
||||||
|
// ALOAD 5
|
||||||
|
// PUTFIELD Reika/DragonAPI/ModList.itemClasses : [Ljava/lang/String;
|
||||||
|
// ALOAD 0
|
||||||
|
// ALOAD 4
|
||||||
|
// PUTFIELD Reika/DragonAPI/ModList.blockClasses : [Ljava/lang/String;
|
||||||
|
// ALOAD 0
|
||||||
|
// INVOKESTATIC ASMHooks.isModLoaded (LReika/DragonAPI/ModList;)V
|
||||||
|
// FRAME FULL [Reika/DragonAPI/ModList java/lang/String I java/lang/String [Ljava/lang/String; [Ljava/lang/String;] []
|
||||||
|
// RETURN
|
||||||
|
iterator.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
iterator.add(new VarInsnNode(Opcodes.ALOAD, 5));
|
||||||
|
iterator.add(new FieldInsnNode(Opcodes.PUTFIELD, "Reika/DragonAPI/ModList", "itemClasses",
|
||||||
|
"[Ljava/lang/String;"));
|
||||||
|
iterator.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
iterator.add(new VarInsnNode(Opcodes.ALOAD, 4));
|
||||||
|
iterator.add(new FieldInsnNode(Opcodes.PUTFIELD, "Reika/DragonAPI/ModList", "blockClasses",
|
||||||
|
"[Ljava/lang/String;"));
|
||||||
|
iterator.next();
|
||||||
|
iterator.remove();
|
||||||
|
iterator.next();
|
||||||
|
iterator.next();
|
||||||
|
iterator.remove();
|
||||||
|
var methodInsn = (MethodInsnNode) iterator.next();
|
||||||
|
methodInsn.owner = Type.getInternalName(ASMHooks.class);
|
||||||
|
methodInsn.name = "DragonAPIModListConstructorTweak";
|
||||||
|
methodInsn.desc = "(LReika/DragonAPI/ModList;)V";
|
||||||
|
iterator.add(new FrameNode(Opcodes.F_FULL, 6,
|
||||||
|
new Object[]{"Reika/DragonAPI/ModList", "java/lang/String", Opcodes.INTEGER,
|
||||||
|
"java/lang/String", "[Ljava/lang/String;",
|
||||||
|
"[Ljava/lang/String;"}, 0, new Object[]{}));
|
||||||
|
iterator.add(new InsnNode(Opcodes.RETURN));
|
||||||
|
iterator.add(new FrameNode(Opcodes.F_FULL, 6,
|
||||||
|
new Object[]{"Reika/DragonAPI/ModList", "java/lang/String", Opcodes.INTEGER,
|
||||||
|
"java/lang/String", "[Ljava/lang/String;",
|
||||||
|
"[Ljava/lang/String;"}, 0, new Object[]{}));
|
||||||
|
iterator.next();
|
||||||
|
iterator.remove();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void crash() {
|
||||||
|
throw new IllegalStateException("Tweaking failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||||
|
int state = 0;
|
||||||
|
for (val field : cn.fields) {
|
||||||
|
if (field.name.equals("__MARKER__FALSEPATTERN__MIXINPATCH__")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (val field : cn.fields) {
|
||||||
|
if (field.name.equals("condition") && field.desc.equals("Z")) {
|
||||||
|
field.access &= ~Opcodes.ACC_FINAL;
|
||||||
|
state++;
|
||||||
|
}
|
||||||
|
if (fields.contains(field.name)) {
|
||||||
|
field.access &= ~Opcodes.ACC_PRIVATE;
|
||||||
|
field.access &= ~Opcodes.ACC_PROTECTED;
|
||||||
|
field.access |= Opcodes.ACC_PUBLIC;
|
||||||
|
state++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state != 4) {
|
||||||
|
crash();
|
||||||
|
}
|
||||||
|
cn.fields.add(new FieldNode(Opcodes.ACC_PUBLIC, "successful", "Z", null, 0));
|
||||||
|
cn.fields.add(new FieldNode(Opcodes.ACC_PRIVATE, "__MARKER__FALSEPATTERN__MIXINPATCH__", "Z", null, 0));
|
||||||
|
|
||||||
|
int state2 = 0;
|
||||||
|
for (val method : cn.methods) {
|
||||||
|
if ((state2 & 1) == 0 && method.name.equals("<init>") &&
|
||||||
|
method.desc.equals("(Ljava/lang/String;ILjava/lang/String;[Ljava/lang/String;[Ljava/lang/String;)V")) {
|
||||||
|
tweakInit(method);
|
||||||
|
state2 |= 1;
|
||||||
|
}
|
||||||
|
if ((state2 & 2) == 0 && method.name.equals("isLoaded") && method.desc.equals("()Z")) {
|
||||||
|
tweakIsLoaded(method);
|
||||||
|
state2 |= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (state2 != 3) {
|
||||||
|
crash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,21 +1,19 @@
|
|||||||
package com.falsepattern.endlessids.asm.transformer;
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.asm.AsmTransformException;
|
||||||
|
import com.falsepattern.endlessids.asm.AsmUtil;
|
||||||
|
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import lombok.var;
|
import lombok.var;
|
||||||
import org.objectweb.asm.tree.FieldNode;
|
|
||||||
import com.falsepattern.endlessids.asm.AsmTransformException;
|
|
||||||
import org.objectweb.asm.tree.MethodNode;
|
|
||||||
import com.falsepattern.endlessids.asm.AsmUtil;
|
|
||||||
import org.objectweb.asm.tree.ClassNode;
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
|
||||||
public class FmlRegistry implements IClassNodeTransformer
|
public class FmlRegistry implements IClassNodeTransformer {
|
||||||
{
|
|
||||||
public FmlRegistry() {
|
public FmlRegistry() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||||
var field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
var field = AsmUtil.findField(cn, "MAX_BLOCK_ID", true);
|
||||||
@@ -28,7 +26,8 @@ public class FmlRegistry implements IClassNodeTransformer
|
|||||||
}
|
}
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final MethodNode method : cn.methods) {
|
for (final MethodNode method : cn.methods) {
|
||||||
if (AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.maxBlockID, ExtendedConstants.maxBlockID, true)) {
|
if (AsmUtil.transformInlinedSizeMethod(cn, method, VanillaConstants.maxBlockID,
|
||||||
|
ExtendedConstants.maxBlockID, true)) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
|
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ public class ExtendedConstants {
|
|||||||
public static final int countCorrectionBits = IEConfig.countCorrectionBits;
|
public static final int countCorrectionBits = IEConfig.countCorrectionBits;
|
||||||
|
|
||||||
public static final int watchableBits = 7;
|
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 nibblesPerID = bitsPerID / 4;
|
||||||
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
|
||||||
|
|
||||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||||
|
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
||||||
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
||||||
|
|
||||||
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
||||||
@@ -24,9 +24,15 @@ public class ExtendedConstants {
|
|||||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
||||||
public static final int bytesPerEBS = nibblesPerEBS / 2;
|
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
||||||
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
|
|
||||||
|
|
||||||
|
//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;
|
||||||
|
//Chunk
|
||||||
|
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
|
||||||
//DataWatcher
|
//DataWatcher
|
||||||
public static final int watchableCount = 1 << watchableBits;
|
public static final int watchableCount = 1 << watchableBits;
|
||||||
public static final int maxWatchableID = watchableCount - 1;
|
public static final int maxWatchableID = watchableCount - 1;
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ public class VanillaConstants {
|
|||||||
public static final int countCorrectionBits = 0;
|
public static final int countCorrectionBits = 0;
|
||||||
|
|
||||||
public static final int watchableBits = 5;
|
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 nibblesPerID = bitsPerID / 4;
|
||||||
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
|
||||||
|
|
||||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||||
|
public static final int nibblesPerMetadata = bitsPerMetadata / 4;
|
||||||
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
public static final int bytesPerIDPlusMetadata = (nibblesPerID + nibblesPerMetadata + 1) / 2;
|
||||||
|
|
||||||
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
public static final int blockIDMask = (1 << bitsPerID) - 1;
|
||||||
@@ -22,9 +22,15 @@ public class VanillaConstants {
|
|||||||
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
public static final int bitsPerBlock = 8 + bitsPerID + bitsPerMetadata;
|
||||||
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
public static final int nibblesPerBlock = bitsPerBlock / 4;
|
||||||
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
public static final int nibblesPerEBS = nibblesPerBlock * 16 * 16 * 16;
|
||||||
public static final int bytesPerEBS = nibblesPerEBS / 2;
|
public static final int bytesPerEBS = (nibblesPerEBS + 1) / 2;
|
||||||
public static final int bytesPerChunk = 256 + bytesPerEBS * 16;
|
|
||||||
|
|
||||||
|
//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;
|
||||||
|
//Chunk
|
||||||
|
public static final int bytesPerChunk = bytesPerBiome * 256 + bytesPerEBS * 16;
|
||||||
//DataWatcher
|
//DataWatcher
|
||||||
public static final int watchableCount = 1 << watchableBits;
|
public static final int watchableCount = 1 << watchableBits;
|
||||||
public static final int maxWatchableID = watchableCount - 1;
|
public static final int maxWatchableID = watchableCount - 1;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public final class AIDCStringFixer {
|
||||||
|
public static String fixString(String str) {
|
||||||
|
str = str.replace("\\", "");
|
||||||
|
str = str.replace("vaible", "vailable");
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.util.function.IntFunction;
|
||||||
|
|
||||||
|
import static com.falsepattern.endlessids.EndlessIDs.BIOME_ARRAY_PLACEHOLDER;
|
||||||
|
|
||||||
|
public class BiomePatchHelper {
|
||||||
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, IntFunction<BiomeGenBase> biomesForGeneration) {
|
||||||
|
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||||
|
chunkBiomes[i] = (short) biomesForGeneration.apply(i).biomeID;
|
||||||
|
}
|
||||||
|
return BIOME_ARRAY_PLACEHOLDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static byte[] getBiomeArrayTweaked(Chunk chunk, BiomeGenBase[] biomesForGeneration) {
|
||||||
|
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < chunkBiomes.length; ++i) {
|
||||||
|
chunkBiomes[i] = (short) biomesForGeneration[i].biomeID;
|
||||||
|
}
|
||||||
|
return BIOME_ARRAY_PLACEHOLDER;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
public interface IChunkMixin {
|
||||||
|
short[] getBiomeShortArray();
|
||||||
|
|
||||||
|
void setBiomeShortArray(short[] data);
|
||||||
|
}
|
||||||
+3
@@ -2,7 +2,10 @@ package com.falsepattern.endlessids.mixin.helpers;
|
|||||||
|
|
||||||
public interface IExtendedBlockStorageMixin {
|
public interface IExtendedBlockStorageMixin {
|
||||||
void setBlockRefCount(int value);
|
void setBlockRefCount(int value);
|
||||||
|
|
||||||
void setTickRefCount(int value);
|
void setTickRefCount(int value);
|
||||||
|
|
||||||
short[] getLSB();
|
short[] getLSB();
|
||||||
|
|
||||||
byte[] getMSB();
|
byte[] getMSB();
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public final class ShortUtil {
|
||||||
|
public static int unsignedShortToInt(short s) {
|
||||||
|
return s & 65535;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int[] unsignedShortToIntArray(short[] shorts) {
|
||||||
|
int[] ints = new int[shorts.length];
|
||||||
|
|
||||||
|
for(int i = 0; i < shorts.length; ++i) {
|
||||||
|
ints[i] = unsignedShortToInt(shorts[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ints;
|
||||||
|
}
|
||||||
|
}
|
||||||
+40
-31
@@ -3,17 +3,18 @@ package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
|||||||
import com.falsepattern.endlessids.Hooks;
|
import com.falsepattern.endlessids.Hooks;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@@ -22,23 +23,28 @@ import java.util.Map;
|
|||||||
@SuppressWarnings({"rawtypes", "WhileLoopReplaceableByForEach", "unchecked"})
|
@SuppressWarnings({"rawtypes", "WhileLoopReplaceableByForEach", "unchecked"})
|
||||||
@Mixin(Chunk.class)
|
@Mixin(Chunk.class)
|
||||||
public abstract class ChunkMixin {
|
public abstract class ChunkMixin {
|
||||||
@Shadow public Map chunkTileEntityMap;
|
@Shadow
|
||||||
|
public Map chunkTileEntityMap;
|
||||||
|
|
||||||
@Shadow public World worldObj;
|
@Shadow
|
||||||
|
public World worldObj;
|
||||||
|
@Shadow
|
||||||
|
public boolean isLightPopulated;
|
||||||
|
@Shadow
|
||||||
|
public boolean isTerrainPopulated;
|
||||||
|
@Shadow
|
||||||
|
private ExtendedBlockStorage[] storageArrays;
|
||||||
|
@Shadow
|
||||||
|
private byte[] blockBiomeArray;
|
||||||
|
|
||||||
@Shadow private ExtendedBlockStorage[] storageArrays;
|
@Shadow
|
||||||
|
public abstract void generateHeightMap();
|
||||||
|
|
||||||
@Shadow private byte[] blockBiomeArray;
|
@Shadow
|
||||||
|
public abstract Block getBlock(int p_150810_1_, int p_150810_2_, int p_150810_3_);
|
||||||
|
|
||||||
@Shadow public boolean isLightPopulated;
|
@Shadow
|
||||||
|
public abstract int getBlockMetadata(int p_76628_1_, int p_76628_2_, int p_76628_3_);
|
||||||
@Shadow public boolean isTerrainPopulated;
|
|
||||||
|
|
||||||
@Shadow public abstract void generateHeightMap();
|
|
||||||
|
|
||||||
@Shadow public abstract Block getBlock(int p_150810_1_, int p_150810_2_, int p_150810_3_);
|
|
||||||
|
|
||||||
@Shadow public abstract int getBlockMetadata(int p_76628_1_, int p_76628_2_, int p_76628_3_);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author FalsePattern
|
* @author FalsePattern
|
||||||
@@ -49,8 +55,8 @@ public abstract class ChunkMixin {
|
|||||||
public void fillChunk(byte[] var1, int var2, int var3, boolean var4) {
|
public void fillChunk(byte[] var1, int var2, int var3, boolean var4) {
|
||||||
Iterator var5 = this.chunkTileEntityMap.values().iterator();
|
Iterator var5 = this.chunkTileEntityMap.values().iterator();
|
||||||
|
|
||||||
while(var5.hasNext()) {
|
while (var5.hasNext()) {
|
||||||
TileEntity var6 = (TileEntity)var5.next();
|
TileEntity var6 = (TileEntity) var5.next();
|
||||||
var6.updateContainingBlockInfo();
|
var6.updateContainingBlockInfo();
|
||||||
var6.getBlockMetadata();
|
var6.getBlockMetadata();
|
||||||
var6.getBlockType();
|
var6.getBlockType();
|
||||||
@@ -60,7 +66,7 @@ public abstract class ChunkMixin {
|
|||||||
boolean var7 = !this.worldObj.provider.hasNoSky;
|
boolean var7 = !this.worldObj.provider.hasNoSky;
|
||||||
|
|
||||||
int var8;
|
int var8;
|
||||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||||
if ((var2 & 1 << var8) != 0) {
|
if ((var2 & 1 << var8) != 0) {
|
||||||
if (this.storageArrays[var8] == null) {
|
if (this.storageArrays[var8] == null) {
|
||||||
this.storageArrays[var8] = new ExtendedBlockStorage(var8 << 4, var7);
|
this.storageArrays[var8] = new ExtendedBlockStorage(var8 << 4, var7);
|
||||||
@@ -74,7 +80,7 @@ public abstract class ChunkMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NibbleArray var9;
|
NibbleArray var9;
|
||||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
||||||
var9 = this.storageArrays[var8].getMetadataArray();
|
var9 = this.storageArrays[var8].getMetadataArray();
|
||||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||||
@@ -82,7 +88,7 @@ public abstract class ChunkMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
||||||
var9 = this.storageArrays[var8].getBlocklightArray();
|
var9 = this.storageArrays[var8].getBlocklightArray();
|
||||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||||
@@ -91,7 +97,7 @@ public abstract class ChunkMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (var7) {
|
if (var7) {
|
||||||
for(var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
||||||
var9 = this.storageArrays[var8].getSkylightArray();
|
var9 = this.storageArrays[var8].getSkylightArray();
|
||||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
||||||
@@ -101,10 +107,10 @@ public abstract class ChunkMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (var4) {
|
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) {
|
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
||||||
if (this.storageArrays[var8] != null && (var2 & 1 << var8) != 0) {
|
if (this.storageArrays[var8] != null && (var2 & 1 << var8) != 0) {
|
||||||
this.storageArrays[var8].removeInvalidBlocks();
|
this.storageArrays[var8].removeInvalidBlocks();
|
||||||
}
|
}
|
||||||
@@ -116,21 +122,24 @@ public abstract class ChunkMixin {
|
|||||||
ArrayList var10 = new ArrayList();
|
ArrayList var10 = new ArrayList();
|
||||||
|
|
||||||
TileEntity var11;
|
TileEntity var11;
|
||||||
for(var5 = this.chunkTileEntityMap.values().iterator(); var5.hasNext(); var11.updateContainingBlockInfo()) {
|
for (var5 = this.chunkTileEntityMap.values().iterator(); var5.hasNext(); var11.updateContainingBlockInfo()) {
|
||||||
var11 = (TileEntity)var5.next();
|
var11 = (TileEntity) var5.next();
|
||||||
int var12 = var11.xCoord & 15;
|
int var12 = var11.xCoord & 15;
|
||||||
int var13 = var11.yCoord;
|
int var13 = var11.yCoord;
|
||||||
int var14 = var11.zCoord & 15;
|
int var14 = var11.zCoord & 15;
|
||||||
Block var15 = var11.getBlockType();
|
Block var15 = var11.getBlockType();
|
||||||
if ((var15 != this.getBlock(var12, var13, var14) || var11.blockMetadata != this.getBlockMetadata(var12, var13, var14)) && var11.shouldRefresh(var15, this.getBlock(var12, var13, var14), var11.blockMetadata, this.getBlockMetadata(var12, var13, var14), this.worldObj, var12, var13, var14)) {
|
if ((var15 != this.getBlock(var12, var13, var14) ||
|
||||||
|
var11.blockMetadata != this.getBlockMetadata(var12, var13, var14)) &&
|
||||||
|
var11.shouldRefresh(var15, this.getBlock(var12, var13, var14), var11.blockMetadata,
|
||||||
|
this.getBlockMetadata(var12, var13, var14), this.worldObj, var12, var13, var14)) {
|
||||||
var10.add(var11);
|
var10.add(var11);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Iterator var17 = var10.iterator();
|
Iterator var17 = var10.iterator();
|
||||||
|
|
||||||
while(var17.hasNext()) {
|
while (var17.hasNext()) {
|
||||||
TileEntity var18 = (TileEntity)var17.next();
|
TileEntity var18 = (TileEntity) var17.next();
|
||||||
var18.invalidate();
|
var18.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-8
@@ -1,14 +1,15 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.multiplayer.WorldClient;
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
import net.minecraft.client.network.NetHandlerPlayClient;
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
@@ -18,7 +19,8 @@ import java.io.IOException;
|
|||||||
@Mixin(NetHandlerPlayClient.class)
|
@Mixin(NetHandlerPlayClient.class)
|
||||||
public abstract class NetHandlerPlayClientMixin {
|
public abstract class NetHandlerPlayClientMixin {
|
||||||
|
|
||||||
@Shadow private WorldClient clientWorldController;
|
@Shadow
|
||||||
|
private WorldClient clientWorldController;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,7 +34,7 @@ public abstract class NetHandlerPlayClientMixin {
|
|||||||
if (packetIn.func_148921_d() != null) {
|
if (packetIn.func_148921_d() != null) {
|
||||||
DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(packetIn.func_148921_d()));
|
DataInputStream dataInput = new DataInputStream(new ByteArrayInputStream(packetIn.func_148921_d()));
|
||||||
|
|
||||||
for(int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
for (int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
||||||
short var6 = dataInput.readShort();
|
short var6 = dataInput.readShort();
|
||||||
short idLSB = dataInput.readShort();
|
short idLSB = dataInput.readShort();
|
||||||
byte idMSB = dataInput.readByte();
|
byte idMSB = dataInput.readByte();
|
||||||
@@ -41,7 +43,8 @@ public abstract class NetHandlerPlayClientMixin {
|
|||||||
int var10 = var6 >> 12 & 15;
|
int var10 = var6 >> 12 & 15;
|
||||||
int var11 = var6 >> 8 & 15;
|
int var11 = var6 >> 8 & 15;
|
||||||
int var12 = var6 & 255;
|
int var12 = var6 & 255;
|
||||||
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(id), var9);
|
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(id),
|
||||||
|
var9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-2
@@ -2,15 +2,17 @@ package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||||
|
|
||||||
@Mixin(PlayerControllerMP.class)
|
@Mixin(PlayerControllerMP.class)
|
||||||
public abstract class PlayerControllerMPMixin {
|
public abstract class PlayerControllerMPMixin {
|
||||||
@ModifyConstant(method = "onPlayerDestroyBlock",
|
@ModifyConstant(method = "onPlayerDestroyBlock",
|
||||||
constant = @Constant(intValue = VanillaConstants.bitsPerID, ordinal = 0),
|
constant = @Constant(intValue = VanillaConstants.bitsPerID,
|
||||||
|
ordinal = 0),
|
||||||
require = 1)
|
require = 1)
|
||||||
private int extend1(int constant) {
|
private int extend1(int constant) {
|
||||||
return ExtendedConstants.bitsPerID;
|
return ExtendedConstants.bitsPerID;
|
||||||
|
|||||||
+4
-3
@@ -2,13 +2,14 @@ package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
import net.minecraft.client.renderer.RenderGlobal;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.RenderGlobal;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Mixin(RenderGlobal.class)
|
@Mixin(RenderGlobal.class)
|
||||||
public abstract class RenderGlobalMixin {
|
public abstract class RenderGlobalMixin {
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
||||||
|
import org.spongepowered.asm.lib.Opcodes;
|
||||||
|
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.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
@Mixin(value = AntiIdConflictBase.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class AntiIdConflictBaseMixin {
|
||||||
|
@Shadow
|
||||||
|
public static File mainFolder;
|
||||||
|
|
||||||
|
@Inject(method = "preinit",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
require = 1)
|
||||||
|
private static void fixPath(FMLPreInitializationEvent event, CallbackInfo ci) {
|
||||||
|
mainFolder = new File(event.getModConfigurationDirectory().getPath(), "AntiIDConflict");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "preinit",
|
||||||
|
at = @At(value = "FIELD",
|
||||||
|
target = "Lcode/elix_x/coremods/antiidconflict/AntiIdConflictBase;mainFolder:Ljava/io/File;",
|
||||||
|
opcode = Opcodes.PUTSTATIC),
|
||||||
|
require = 1)
|
||||||
|
private static void removeOldPut(File value) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
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.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 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 (register) {
|
||||||
|
if (biomeList[id] instanceof PlaceholderBiome) {
|
||||||
|
biomeList[id] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AsmHooks.getBiomeID(id, register);
|
||||||
|
}
|
||||||
|
}
|
||||||
+218
@@ -0,0 +1,218 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.AntiIdConflictBase;
|
||||||
|
import code.elix_x.coremods.antiidconflict.managers.BiomesManager;
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||||
|
import lombok.val;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import static code.elix_x.coremods.antiidconflict.managers.BiomesManager.conflicts;
|
||||||
|
|
||||||
|
@Mixin(value = BiomesManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class BiomesManagerMixin {
|
||||||
|
@Shadow
|
||||||
|
public static String freeBiomeIDs;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public static String occupiedBiomeIDs;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public static boolean debug;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public static int IconflictedIds;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public static String conflictedIds;
|
||||||
|
|
||||||
|
private static String[] getIntervalNaming(int first, int last) {
|
||||||
|
if (first == last) {
|
||||||
|
return new String[]{Integer.toString(first)};
|
||||||
|
} else if (first + 1 == last) {
|
||||||
|
return new String[]{Integer.toString(first), Integer.toString(last)};
|
||||||
|
} else {
|
||||||
|
return new String[]{first + "-" + last};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 1)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
|
||||||
|
constant = {@Constant(stringValue = "\\biomes"),
|
||||||
|
@Constant(stringValue = "\\main.cfg")})
|
||||||
|
private static String fixPaths(String original) {
|
||||||
|
return AIDCStringFixer.fixString(original);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Better code, and detecting empty areas.
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public static void updateBiomesFolder() throws Exception {
|
||||||
|
val biomes = BiomeGenBase.getBiomeGenArray();
|
||||||
|
val builder = new StringBuilder();
|
||||||
|
boolean hasEmpty = false;
|
||||||
|
int emptyRegionStart = 0;
|
||||||
|
for (int i = 0; i < biomes.length; ++i) {
|
||||||
|
if (biomes[i] == null) {
|
||||||
|
if (!hasEmpty) {
|
||||||
|
emptyRegionStart = i;
|
||||||
|
hasEmpty = true;
|
||||||
|
}
|
||||||
|
++BiomesManager.freeIds;
|
||||||
|
} else if (hasEmpty) {
|
||||||
|
hasEmpty = false;
|
||||||
|
for (val part : getIntervalNaming(emptyRegionStart, i - 1)) {
|
||||||
|
builder.append(part).append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasEmpty) {
|
||||||
|
for (val part : getIntervalNaming(emptyRegionStart, ExtendedConstants.biomeIDCount - 1)) {
|
||||||
|
builder.append(part).append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
freeBiomeIDs = builder.toString();
|
||||||
|
builder.setLength(0);
|
||||||
|
|
||||||
|
System.out.println("Found " + BiomesManager.freeIds + " free biome ids in total.");
|
||||||
|
|
||||||
|
for (val biome : biomes) {
|
||||||
|
if (biome != null) {
|
||||||
|
builder.append(biome.biomeID)
|
||||||
|
.append(" : ")
|
||||||
|
.append(biome.biomeName)
|
||||||
|
.append(" (")
|
||||||
|
.append(biome.getBiomeClass())
|
||||||
|
.append(")\n");
|
||||||
|
++BiomesManager.occupiedIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
occupiedBiomeIDs = builder.toString();
|
||||||
|
builder.setLength(0);
|
||||||
|
|
||||||
|
System.out.println("Found " + BiomesManager.occupiedIds + " occupied biome ids in total.");
|
||||||
|
|
||||||
|
for (val conflict : conflicts) {
|
||||||
|
if (conflict != null) {
|
||||||
|
if (debug) {
|
||||||
|
System.out.println(
|
||||||
|
"Found biomes id conflict for " + conflict.ID + " : " + conflict.getCrashMessage());
|
||||||
|
}
|
||||||
|
builder.append(conflict.getCrashMessage()).append('\n');
|
||||||
|
++IconflictedIds;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conflictedIds = builder.toString();
|
||||||
|
builder.setLength(0);
|
||||||
|
|
||||||
|
System.out.println("Found " + IconflictedIds + " conflicted biome ids in total.");
|
||||||
|
File available = new File(AntiIdConflictBase.biomesFolder, "availableIDs.txt");
|
||||||
|
if (available.exists()) {
|
||||||
|
available.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
available.createNewFile();
|
||||||
|
PrintWriter writer = new PrintWriter(available);
|
||||||
|
writer.println("Total amount of free biome ids: " + available);
|
||||||
|
writer.println("List of free biome ids:");
|
||||||
|
val freeIDs = freeBiomeIDs.split("\n");
|
||||||
|
|
||||||
|
for (val freeID : freeIDs) {
|
||||||
|
writer.println(freeID);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.close();
|
||||||
|
val occupied = new File(AntiIdConflictBase.biomesFolder, "occupiedIDs.txt");
|
||||||
|
if (occupied.exists()) {
|
||||||
|
occupied.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
occupied.createNewFile();
|
||||||
|
writer = new PrintWriter(occupied);
|
||||||
|
writer.println("Total amount of occupied biome ids: " + BiomesManager.occupiedIds);
|
||||||
|
writer.println("Table of occupied biome ids and their owners");
|
||||||
|
writer.println("id:name(class)");
|
||||||
|
val occupiedIDs = occupiedBiomeIDs.split("\n");
|
||||||
|
|
||||||
|
for (String occupiedID : occupiedIDs) {
|
||||||
|
writer.println(occupiedID);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.close();
|
||||||
|
val conflicted = new File(AntiIdConflictBase.biomesFolder, "conflictedIDs.txt");
|
||||||
|
if (conflicted.exists()) {
|
||||||
|
conflicted.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
conflicted.createNewFile();
|
||||||
|
writer = new PrintWriter(conflicted);
|
||||||
|
writer.println("Total amount of conflicted biome ids: " + IconflictedIds);
|
||||||
|
writer.println("IDs in conflict:\n");
|
||||||
|
val conflictedIDs = conflictedIds.split("\n");
|
||||||
|
for (val conflictedID : conflictedIDs) {
|
||||||
|
writer.println(conflictedID);
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.close();
|
||||||
|
val all = new File(AntiIdConflictBase.biomesFolder, "AllIDs.txt");
|
||||||
|
writer = new PrintWriter(all);
|
||||||
|
writer.println("Total amount of free biome ids: " + BiomesManager.freeIds);
|
||||||
|
writer.println("Total amount of occupied biome ids: " + BiomesManager.occupiedIds);
|
||||||
|
writer.println("Total amount of conflicted biome ids: " + IconflictedIds);
|
||||||
|
writer.println("All ids and their position:");
|
||||||
|
|
||||||
|
hasEmpty = false;
|
||||||
|
emptyRegionStart = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < biomes.length; ++i) {
|
||||||
|
if (!ArrayUtils.isEmpty(conflicts) && conflicts[i] != null) {
|
||||||
|
writer.println(conflicts[i].getCrashMessage());
|
||||||
|
} else if (biomes[i] != null) {
|
||||||
|
if (hasEmpty) {
|
||||||
|
hasEmpty = false;
|
||||||
|
for (val part : getIntervalNaming(emptyRegionStart, i - 1)) {
|
||||||
|
writer.print(part);
|
||||||
|
writer.println(" is Available");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writer.print(i);
|
||||||
|
writer.print(" is Occupied by ");
|
||||||
|
writer.print(biomes[i].biomeName);
|
||||||
|
writer.print(" (");
|
||||||
|
writer.print(biomes[i].getBiomeClass().getName());
|
||||||
|
writer.println(")");
|
||||||
|
} else if (!hasEmpty) {
|
||||||
|
hasEmpty = true;
|
||||||
|
emptyRegionStart = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasEmpty) {
|
||||||
|
for (val part : getIntervalNaming(emptyRegionStart, ExtendedConstants.biomeIDCount - 1)) {
|
||||||
|
writer.print(part);
|
||||||
|
writer.println(" is Available");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writer.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.managers.DimensionsManager;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = DimensionsManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class DimensionsManagerMixin {
|
||||||
|
|
||||||
|
@ModifyConstant(method = "*",
|
||||||
|
constant = {@Constant(stringValue = "\\dimensions"),
|
||||||
|
@Constant(stringValue = "\\main.cfg"),
|
||||||
|
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\AllIDs.txt")})
|
||||||
|
private static String fixPaths(String original) {
|
||||||
|
return AIDCStringFixer.fixString(original);
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.managers.EnchantementsManager;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = EnchantementsManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class EnchantementsManagerMixin {
|
||||||
|
|
||||||
|
@ModifyConstant(method = "*",
|
||||||
|
constant = {@Constant(stringValue = "\\enchantements"),
|
||||||
|
@Constant(stringValue = "\\main.cfg"),
|
||||||
|
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\AllIDs.txt")})
|
||||||
|
private static String fixPaths(String original) {
|
||||||
|
return AIDCStringFixer.fixString(original);
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.managers.EntitiesManager;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = EntitiesManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class EntitiesManagerMixin {
|
||||||
|
|
||||||
|
@ModifyConstant(method = "*",
|
||||||
|
constant = {@Constant(stringValue = "\\entities"),
|
||||||
|
@Constant(stringValue = "\\main.cfg"),
|
||||||
|
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\AllIDs.txt")})
|
||||||
|
private static String fixPaths(String original) {
|
||||||
|
return AIDCStringFixer.fixString(original);
|
||||||
|
}
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiidconflict;
|
||||||
|
|
||||||
|
import code.elix_x.coremods.antiidconflict.managers.PotionsManager;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.AIDCStringFixer;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = PotionsManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class PotionsManagerMixin {
|
||||||
|
|
||||||
|
@ModifyConstant(method = "*",
|
||||||
|
constant = {@Constant(stringValue = "\\potions"),
|
||||||
|
@Constant(stringValue = "\\main.cfg"),
|
||||||
|
@Constant(stringValue = "\\avaibleIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\occupiedIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\conflictedIDs.txt"),
|
||||||
|
@Constant(stringValue = "\\AllIDs.txt")})
|
||||||
|
private static String fixPaths(String original) {
|
||||||
|
return AIDCStringFixer.fixString(original);
|
||||||
|
}
|
||||||
|
}
|
||||||
+49
@@ -0,0 +1,49 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
||||||
|
|
||||||
|
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.ShortUtil;
|
||||||
|
import hunternif.mc.atlas.core.BiomeDetectorBase;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = BiomeDetectorBase.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class BiomeDetectorBaseMixin {
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 2)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Chunk chunk;
|
||||||
|
|
||||||
|
@Redirect(method = "getBiomeID",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
require = 1)
|
||||||
|
private byte[] disableGetter(Chunk instance) {
|
||||||
|
chunk = instance;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "getBiomeID",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lhunternif/mc/atlas/util/ByteUtil;unsignedByteToIntArray([B)[I"),
|
||||||
|
require = 1)
|
||||||
|
private int[] biomeIDs(byte[] i) {
|
||||||
|
try {
|
||||||
|
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||||
|
} finally {
|
||||||
|
chunk = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||||
|
import hunternif.mc.atlas.core.BiomeDetectorNether;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = BiomeDetectorNether.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class BiomeDetectorNetherMixin {
|
||||||
|
private Chunk chunk;
|
||||||
|
|
||||||
|
@Redirect(method = "getBiomeID",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
require = 1)
|
||||||
|
private byte[] disableGetter(Chunk instance) {
|
||||||
|
chunk = instance;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "getBiomeID",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lhunternif/mc/atlas/util/ByteUtil;unsignedByteToIntArray([B)[I"),
|
||||||
|
require = 1)
|
||||||
|
private int[] biomeIDs(byte[] i) {
|
||||||
|
try {
|
||||||
|
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||||
|
} finally {
|
||||||
|
chunk = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import ttftcuts.atg.config.configfiles.ATGBiomeConfig;
|
||||||
|
|
||||||
|
@Mixin(value = ATGBiomeConfig.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ATGBiomeConfigMixin {
|
||||||
|
@ModifyConstant(method = {"<clinit>", "postInit"},
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 4)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import ttftcuts.atg.gen.ATGBiomeManager;
|
||||||
|
|
||||||
|
@Mixin(value = ATGBiomeManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ATGBiomeManagerMixin {
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 1)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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 ttftcuts.atg.ATGChunkProvider;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = ATGChunkProvider.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ATGChunkProviderMixin {
|
||||||
|
@Shadow
|
||||||
|
private BiomeGenBase[] biomesForGeneration;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import ttftcuts.atg.feature.ATGWorldGenRocks;
|
||||||
|
|
||||||
|
@Mixin(value = ATGWorldGenRocks.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ATGWorldGenRocksMixin {
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 3)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.bop;
|
||||||
|
|
||||||
|
import biomesoplenty.common.world.BOPBiomeManager;
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = BOPBiomeManager.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class BOPBiomeManagerMixin {
|
||||||
|
@ModifyConstant(method = "getNextFreeBiomeId",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 1)
|
||||||
|
private static int extendIDs1(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "getNextFreeBiomeId",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount - 1),
|
||||||
|
require = 1)
|
||||||
|
private static int extendIDs2(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.bop;
|
||||||
|
|
||||||
|
import biomesoplenty.common.world.ChunkProviderBOPEnd;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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 net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = ChunkProviderBOPEnd.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ChunkProviderBOPEndMixin {
|
||||||
|
@Shadow
|
||||||
|
private BiomeGenBase[] biomesForGeneration;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
|
||||||
|
}
|
||||||
|
}
|
||||||
+47
@@ -0,0 +1,47 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.bop;
|
||||||
|
|
||||||
|
import biomesoplenty.common.world.ChunkProviderBOPHell;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = ChunkProviderBOPHell.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ChunkProviderBOPHellMixin {
|
||||||
|
private BiomeGenBase[] bgb;
|
||||||
|
|
||||||
|
@Inject(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
shift = At.Shift.BEFORE,
|
||||||
|
remap = true),
|
||||||
|
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private void setBiomesTweaked1(int par1, int par2, CallbackInfoReturnable<Chunk> cir, byte[] abyte, Block[] blocks, Chunk chunk, BiomeGenBase[] abiomegenbase) {
|
||||||
|
bgb = abiomegenbase;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked2(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
|
||||||
|
} finally {
|
||||||
|
bgb = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-2
@@ -7,10 +7,12 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
@Mixin(value = BlockHelper.class, remap = false)
|
@Mixin(value = BlockHelper.class,
|
||||||
|
remap = false)
|
||||||
public abstract class BlockHelperMixin {
|
public abstract class BlockHelperMixin {
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
constant = {@Constant(intValue = VanillaConstants.blockIDCount), @Constant(intValue = VanillaConstants.blockIDCount / 4)},
|
constant = {@Constant(intValue = VanillaConstants.blockIDCount),
|
||||||
|
@Constant(intValue = VanillaConstants.blockIDCount / 4)},
|
||||||
require = 1)
|
require = 1)
|
||||||
private static int extend(int constant) {
|
private static int extend(int constant) {
|
||||||
return ExtendedConstants.blockIDCount;
|
return ExtendedConstants.blockIDCount;
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
@Mixin(value = BlockProperties.class, remap = false)
|
@Mixin(value = BlockProperties.class,
|
||||||
|
remap = false)
|
||||||
public abstract class BlockPropertiesMixin {
|
public abstract class BlockPropertiesMixin {
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
constant = @Constant(intValue = VanillaConstants.blockIDCount),
|
constant = @Constant(intValue = VanillaConstants.blockIDCount),
|
||||||
|
|||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||||
|
|
||||||
|
import Reika.DragonAPI.Instantiable.Event.GenLayerRiverEvent;
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = GenLayerRiverEvent.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class GenLayerRiverEventMixin {
|
||||||
|
@ModifyConstant(method = "fire_1614",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||||
|
require = 2)
|
||||||
|
private static int increaseBiomeMask(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDMask;
|
||||||
|
}
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
||||||
|
|
||||||
|
import Reika.DragonAPI.Extras.IDType;
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = IDType.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class IDTypeMixin {
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = @Constant(intValue = 254),
|
||||||
|
require = 1)
|
||||||
|
private static int extendBiomeIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount - 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = {@Constant(intValue = 4095), @Constant(intValue = 32767)},
|
||||||
|
require = 2)
|
||||||
|
private static int extendBlockItemIDs(int constant) {
|
||||||
|
return ExtendedConstants.maxBlockID;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi.vanilla;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.world.gen.layer.GenLayerRiverMix;
|
||||||
|
|
||||||
|
@Mixin(GenLayerRiverMix.class)
|
||||||
|
public abstract class GenLayerRiverMixMixin {
|
||||||
|
@ModifyConstant(method = "getInts",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDMask),
|
||||||
|
expect = -1)
|
||||||
|
private int extendTheID(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDMask;
|
||||||
|
}
|
||||||
|
}
|
||||||
+54
@@ -0,0 +1,54 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.extrautilities;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.EndlessIDs;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
|
import com.rwtema.extrautils.worldgen.endoftime.ChunkProviderEndOfTime;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Mixin(value = ChunkProviderEndOfTime.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ChunkProviderEndOfTimeMixin {
|
||||||
|
private int id;
|
||||||
|
private Chunk chunk;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked1(Chunk instance) {
|
||||||
|
chunk = instance;
|
||||||
|
return EndlessIDs.BIOME_ARRAY_PLACEHOLDER;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "FIELD",
|
||||||
|
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeID:I",
|
||||||
|
remap = true),
|
||||||
|
remap = true)
|
||||||
|
private int setBiomesTweaked2(BiomeGenBase instance) {
|
||||||
|
return id = instance.biomeID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Ljava/util/Arrays;fill([BB)V"),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private void setBiomesTweaked3(byte[] bytes, byte b) {
|
||||||
|
try {
|
||||||
|
Arrays.fill(((IChunkMixin) chunk).getBiomeShortArray(), (short) id);
|
||||||
|
} finally {
|
||||||
|
chunk = null;
|
||||||
|
id = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.extrautilities;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
import com.rwtema.extrautils.worldgen.Underdark.ChunkProviderUnderdark;
|
||||||
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = ChunkProviderUnderdark.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ChunkProviderUnderdarkMixin {
|
||||||
|
private BiomeGenBase[] bgb;
|
||||||
|
|
||||||
|
@SuppressWarnings("InvalidInjectorMethodSignature")
|
||||||
|
@Inject(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
shift = At.Shift.BEFORE,
|
||||||
|
remap = true),
|
||||||
|
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private void setBiomesTweaked1(int par1, int par2, CallbackInfoReturnable<Chunk> cir, Chunk chunk, Block[] arr, int spire_x, int spire_z, Block stone_type, BiomeGenBase[] abiomegenbase) {
|
||||||
|
bgb = abiomegenbase;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked2(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
|
||||||
|
} finally {
|
||||||
|
bgb = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.icg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import net.tclproject.mysteriumlib.asm.fixes.MysteriumPatchesFixesCave;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
@Mixin(value = MysteriumPatchesFixesCave.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class MysteriumPatchesFixesCaveMixin {
|
||||||
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 1)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
-6
@@ -7,14 +7,15 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
@Mixin(value = MFQM.class, remap = false)
|
@Mixin(value = MFQM.class,
|
||||||
|
remap = false)
|
||||||
public abstract class MFQMDataWatcherMixin {
|
public abstract class MFQMDataWatcherMixin {
|
||||||
@ModifyConstant(method = "preInit",
|
@ModifyConstant(method = "preInit",
|
||||||
constant = {
|
constant = {@Constant(intValue = VanillaConstants.maxWatchableID,
|
||||||
@Constant(intValue = VanillaConstants.maxWatchableID, ordinal = 0),
|
ordinal = 0), @Constant(intValue = VanillaConstants.maxWatchableID,
|
||||||
@Constant(intValue = VanillaConstants.maxWatchableID, ordinal = 1),
|
ordinal = 1),
|
||||||
@Constant(intValue = VanillaConstants.maxWatchableID, ordinal = 2)
|
@Constant(intValue = VanillaConstants.maxWatchableID,
|
||||||
},
|
ordinal = 2)},
|
||||||
require = 3)
|
require = 3)
|
||||||
private int extendWatchableIDLimit(int constant) {
|
private int extendWatchableIDLimit(int constant) {
|
||||||
return ExtendedConstants.maxWatchableID;
|
return ExtendedConstants.maxWatchableID;
|
||||||
|
|||||||
@@ -7,22 +7,22 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
@Mixin(value = MFQM.class, remap = false)
|
@Mixin(value = MFQM.class,
|
||||||
|
remap = false)
|
||||||
public abstract class MFQMMixin {
|
public abstract class MFQMMixin {
|
||||||
@ModifyConstant(method = "preInit",
|
|
||||||
constant = {
|
|
||||||
@Constant(intValue = VanillaConstants.maxBlockID),
|
|
||||||
@Constant(intValue = 31999)
|
|
||||||
},
|
|
||||||
require = 2)
|
|
||||||
private int extendWatchableIDLimit(int constant) {
|
|
||||||
return ExtendedConstants.maxBlockID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyConstant(method = "preInit",
|
@ModifyConstant(method = "preInit",
|
||||||
constant = @Constant(stringValue = "Must be different in range between 20 and 31"),
|
constant = @Constant(stringValue = "Must be different in range between 20 and 31"),
|
||||||
require = 1)
|
require = 1)
|
||||||
private String changeConfigText(String constant) {
|
private String changeConfigText(String constant) {
|
||||||
return constant + " (Notice from EndlessIDs: If you enable the ExtendDataWatcher config option in the endlessids config file, the maximum value will be 127 instead, same for the other datawatcher ids in this file)";
|
return constant +
|
||||||
|
" (Notice from EndlessIDs: If you enable the ExtendDataWatcher config option in the endlessids config file, the maximum value will be 127 instead, same for the other datawatcher ids in this file)";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "postInit",
|
||||||
|
constant = {@Constant(intValue = VanillaConstants.maxBlockID), @Constant(intValue = 31999)},
|
||||||
|
require = 2)
|
||||||
|
private int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.maxBlockID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.naturescompass;
|
||||||
|
|
||||||
|
import com.chaosthedude.naturescompass.util.BiomeUtils;
|
||||||
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
|
@Mixin(value = BiomeUtils.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class BiomeUtilsMixin {
|
||||||
|
@Inject(method = "biomeIsBlacklisted",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
cancellable = true,
|
||||||
|
require = 1)
|
||||||
|
private static void blockPlaceholders(BiomeGenBase biome, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
if (biome instanceof PlaceholderBiome) {
|
||||||
|
cir.setReturnValue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.rtg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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 rtg.world.gen.ChunkProviderRTG;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = ChunkProviderRTG.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ChunkProviderRTGMixin {
|
||||||
|
@Shadow
|
||||||
|
private BiomeGenBase[] baseBiomesList;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private int[] xyinverted;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, (i) -> baseBiomesList[xyinverted[i]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private void removeUnnecessarySet(Chunk chunk, byte[] bytes) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.rtg;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import rtg.world.gen.LandscapeGenerator;
|
||||||
|
|
||||||
|
@Mixin(value = LandscapeGenerator.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class LandscapeGeneratorMixin {
|
||||||
|
@ModifyConstant(method = "getNewerNoise",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 1)
|
||||||
|
private int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.rtg;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import rtg.world.biome.realistic.RealisticBiomeBase;
|
||||||
|
|
||||||
|
@Mixin(RealisticBiomeBase.class)
|
||||||
|
public abstract class RealisticBiomeBaseMixin {
|
||||||
|
}
|
||||||
+37
@@ -0,0 +1,37 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.thaumcraft;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import thaumcraft.common.lib.network.PacketHandler;
|
||||||
|
import thaumcraft.common.lib.network.misc.PacketBiomeChange;
|
||||||
|
import thaumcraft.common.lib.utils.Utils;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
|
@Mixin(value = Utils.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class UtilsMixin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Biome ID Extension
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public static void setBiomeAt(World world, int x, int z, BiomeGenBase biome) {
|
||||||
|
if (biome != null) {
|
||||||
|
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||||
|
short[] array = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
|
array[(z & 15) << 4 | x & 15] = (short) (biome.biomeID);
|
||||||
|
if (!world.isRemote) {
|
||||||
|
PacketHandler.INSTANCE.sendToAllAround(new PacketBiomeChange(x, z, (short) biome.biomeID),
|
||||||
|
new NetworkRegistry.TargetPoint(world.provider.dimensionId, x,
|
||||||
|
world.getHeightValue(x, z), z,
|
||||||
|
32.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.twilightforest;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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 twilightforest.world.ChunkProviderTwilightForest;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
@Mixin(value = ChunkProviderTwilightForest.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class ChunkProviderTwilightForestMixin {
|
||||||
|
@Shadow
|
||||||
|
private BiomeGenBase[] biomesForGeneration;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
remap = true),
|
||||||
|
remap = true,
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.twilightforest;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
import twilightforest.biomes.TFBiomeBase;
|
||||||
|
|
||||||
|
@Mixin(value = TFBiomeBase.class,
|
||||||
|
remap = false)
|
||||||
|
public abstract class TFBiomeBaseMixin {
|
||||||
|
@ModifyConstant(method = "findNextOpenBiomeId",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
|
require = 1)
|
||||||
|
private static int extendIDs(int constant) {
|
||||||
|
return ExtendedConstants.biomeIDCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
-11
@@ -3,45 +3,53 @@ package com.falsepattern.endlessids.mixin.mixins.common.ubc;
|
|||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
import exterminatorJeff.undergroundBiomes.worldGen.BiomeUndergroundDecorator;
|
import exterminatorJeff.undergroundBiomes.worldGen.BiomeUndergroundDecorator;
|
||||||
import exterminatorJeff.undergroundBiomes.worldGen.OreUBifier;
|
import exterminatorJeff.undergroundBiomes.worldGen.OreUBifier;
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
@Mixin(value = BiomeUndergroundDecorator.class, remap = false)
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
|
@Mixin(value = BiomeUndergroundDecorator.class,
|
||||||
|
remap = false)
|
||||||
public abstract class BiomeUndergroundDecoratorMixin {
|
public abstract class BiomeUndergroundDecoratorMixin {
|
||||||
private static NibbleArray fakeArray;
|
private static NibbleArray fakeArray;
|
||||||
private ThreadLocal<IExtendedBlockStorageMixin> ebs;
|
private ThreadLocal<IExtendedBlockStorageMixin> ebs;
|
||||||
|
|
||||||
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V",
|
||||||
|
"replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
||||||
at = @At(value = "INVOKE",
|
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)
|
require = 2)
|
||||||
private byte[] returnMSBasLSB(ExtendedBlockStorage instance) {
|
private byte[] returnMSBasLSB(ExtendedBlockStorage instance) {
|
||||||
if (ebs == null) ebs = new ThreadLocal<>();
|
if (ebs == null) {
|
||||||
|
ebs = new ThreadLocal<>();
|
||||||
|
}
|
||||||
IExtendedBlockStorageMixin iebs = (IExtendedBlockStorageMixin) instance;
|
IExtendedBlockStorageMixin iebs = (IExtendedBlockStorageMixin) instance;
|
||||||
ebs.set(iebs);
|
ebs.set(iebs);
|
||||||
return iebs.getMSB();
|
return iebs.getMSB();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V",
|
||||||
|
"replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
||||||
at = @At(value = "INVOKE",
|
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)
|
require = 4)
|
||||||
private NibbleArray returnFakeArray(ExtendedBlockStorage instance) {
|
private NibbleArray returnFakeArray(ExtendedBlockStorage instance) {
|
||||||
return fakeArray == null ? (fakeArray = new NibbleArray(4096, 4)) : fakeArray;
|
return fakeArray == null ? (fakeArray = new NibbleArray(4096, 4)) : fakeArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V",
|
||||||
|
"replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
||||||
at = @At(value = "INVOKE",
|
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)
|
require = 2)
|
||||||
private int returnRestOfID(NibbleArray instance, int x, int y, int z) {
|
private int returnRestOfID(NibbleArray instance, int x, int y, int z) {
|
||||||
return ebs.get().getLSB()[y << 8 | z << 4 | x] & 0xFFFF;
|
return ebs.get().getLSB()[y << 8 | z << 4 | x] & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V", "replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
@Redirect(method = {"replaceChunkOres(IILnet/minecraft/world/World;)V",
|
||||||
|
"replaceChunkOres(Lnet/minecraft/world/chunk/IChunkProvider;II)V"},
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "LexterminatorJeff/undergroundBiomes/worldGen/OreUBifier;blockReplacer(I)LexterminatorJeff/undergroundBiomes/worldGen/OreUBifier$BlockReplacer;"),
|
target = "LexterminatorJeff/undergroundBiomes/worldGen/OreUBifier;blockReplacer(I)LexterminatorJeff/undergroundBiomes/worldGen/OreUBifier$BlockReplacer;"),
|
||||||
require = 2)
|
require = 2)
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,8 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
@Mixin(value = OreUBifier.class, remap = false)
|
@Mixin(value = OreUBifier.class,
|
||||||
|
remap = false)
|
||||||
public abstract class OreUBifierMixin {
|
public abstract class OreUBifierMixin {
|
||||||
@ModifyConstant(method = "renewBlockReplacers",
|
@ModifyConstant(method = "renewBlockReplacers",
|
||||||
constant = @Constant(intValue = VanillaConstants.blockIDCount),
|
constant = @Constant(intValue = VanillaConstants.blockIDCount),
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.biome;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
@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();
|
||||||
|
for (int i = 0; i < biomes.length; i++) {
|
||||||
|
if (biomes[i] instanceof PlaceholderBiome) {
|
||||||
|
biomes[i] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
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 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;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
|
@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 id, boolean register, CallbackInfo ci) {
|
||||||
|
if (((Object) this) instanceof PlaceholderBiome || !register) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-1
@@ -2,11 +2,12 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.misc;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.block.BlockFire;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockFire;
|
||||||
|
|
||||||
@Mixin(BlockFire.class)
|
@Mixin(BlockFire.class)
|
||||||
public abstract class BlockFireMixin {
|
public abstract class BlockFireMixin {
|
||||||
@ModifyConstant(method = {"<init>", "rebuildFireInfo", "getFlammability", "getEncouragement"},
|
@ModifyConstant(method = {"<init>", "rebuildFireInfo", "getFlammability", "getEncouragement"},
|
||||||
|
|||||||
+14
-9
@@ -3,9 +3,6 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.misc;
|
|||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.DataWatcher;
|
|
||||||
import net.minecraft.network.PacketBuffer;
|
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -13,13 +10,18 @@ import org.spongepowered.asm.mixin.injection.Constant;
|
|||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.entity.DataWatcher;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.util.ChunkCoordinates;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mixin(DataWatcher.class)
|
@Mixin(DataWatcher.class)
|
||||||
public abstract class DataWatcherMixin {
|
public abstract class DataWatcherMixin {
|
||||||
@ModifyConstant(method = {"addObject", "writeWatchedListToPacketBuffer", "func_151509_a", "writeWatchableObjectToPacketBuffer"},
|
@ModifyConstant(method = {"addObject", "writeWatchedListToPacketBuffer", "func_151509_a",
|
||||||
|
"writeWatchableObjectToPacketBuffer"},
|
||||||
constant = @Constant(intValue = VanillaConstants.maxWatchableID),
|
constant = @Constant(intValue = VanillaConstants.maxWatchableID),
|
||||||
require = 4)
|
require = 4)
|
||||||
private static int extend1(int constant) {
|
private static int extend1(int constant) {
|
||||||
@@ -27,14 +29,16 @@ public abstract class DataWatcherMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = "writeWatchableObjectToPacketBuffer",
|
@ModifyConstant(method = "writeWatchableObjectToPacketBuffer",
|
||||||
constant = @Constant(intValue = VanillaConstants.watchableBits, ordinal = 0),
|
constant = @Constant(intValue = VanillaConstants.watchableBits,
|
||||||
|
ordinal = 0),
|
||||||
require = 1)
|
require = 1)
|
||||||
private static int extend2(int constant) {
|
private static int extend2(int constant) {
|
||||||
return ExtendedConstants.watchableBits;
|
return ExtendedConstants.watchableBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = "writeWatchableObjectToPacketBuffer",
|
@ModifyConstant(method = "writeWatchableObjectToPacketBuffer",
|
||||||
constant = @Constant(intValue = VanillaConstants.watchableMask, ordinal = 0),
|
constant = @Constant(intValue = VanillaConstants.watchableMask,
|
||||||
|
ordinal = 0),
|
||||||
require = 1)
|
require = 1)
|
||||||
private static int extend3(int constant) {
|
private static int extend3(int constant) {
|
||||||
return ExtendedConstants.watchableMask;
|
return ExtendedConstants.watchableMask;
|
||||||
@@ -53,10 +57,11 @@ public abstract class DataWatcherMixin {
|
|||||||
* @reason Direct port from dumped code
|
* @reason Direct port from dumped code
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static List<DataWatcher.WatchableObject> readWatchedListFromPacketBuffer(PacketBuffer packet) throws IOException {
|
public static List<DataWatcher.WatchableObject> readWatchedListFromPacketBuffer(PacketBuffer packet)
|
||||||
|
throws IOException {
|
||||||
ArrayList<DataWatcher.WatchableObject> watchables = null;
|
ArrayList<DataWatcher.WatchableObject> watchables = null;
|
||||||
|
|
||||||
for(short id = packet.readShort(); id != 32767; id = packet.readShort()) {
|
for (short id = packet.readShort(); id != 32767; id = packet.readShort()) {
|
||||||
if (watchables == null) {
|
if (watchables == null) {
|
||||||
watchables = new ArrayList<>();
|
watchables = new ArrayList<>();
|
||||||
}
|
}
|
||||||
@@ -64,7 +69,7 @@ public abstract class DataWatcherMixin {
|
|||||||
int flag = (id >> ExtendedConstants.watchableBits) & 0x7;
|
int flag = (id >> ExtendedConstants.watchableBits) & 0x7;
|
||||||
int watchableID = id & ExtendedConstants.maxWatchableID;
|
int watchableID = id & ExtendedConstants.maxWatchableID;
|
||||||
DataWatcher.WatchableObject watchable = null;
|
DataWatcher.WatchableObject watchable = null;
|
||||||
switch(flag) {
|
switch (flag) {
|
||||||
case 0:
|
case 0:
|
||||||
watchable = new DataWatcher.WatchableObject(flag, watchableID, packet.readByte());
|
watchable = new DataWatcher.WatchableObject(flag, watchableID, packet.readByte());
|
||||||
break;
|
break;
|
||||||
|
|||||||
+4
-2
@@ -2,15 +2,17 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.misc;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.server.management.ItemInWorldManager;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.server.management.ItemInWorldManager;
|
||||||
|
|
||||||
@Mixin(ItemInWorldManager.class)
|
@Mixin(ItemInWorldManager.class)
|
||||||
public abstract class ItemInWorldManagerMixin {
|
public abstract class ItemInWorldManagerMixin {
|
||||||
@ModifyConstant(method = "tryHarvestBlock",
|
@ModifyConstant(method = "tryHarvestBlock",
|
||||||
constant = @Constant(intValue = VanillaConstants.bitsPerID, ordinal = 0),
|
constant = @Constant(intValue = VanillaConstants.bitsPerID,
|
||||||
|
ordinal = 0),
|
||||||
require = 1)
|
require = 1)
|
||||||
private int extend1(int constant) {
|
private int extend1(int constant) {
|
||||||
return ExtendedConstants.bitsPerID;
|
return ExtendedConstants.bitsPerID;
|
||||||
|
|||||||
+2
-1
@@ -2,11 +2,12 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.misc;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.stats.StatList;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.stats.StatList;
|
||||||
|
|
||||||
@Mixin(StatList.class)
|
@Mixin(StatList.class)
|
||||||
public abstract class StatListMixin {
|
public abstract class StatListMixin {
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
|
|||||||
+2
-1
@@ -2,11 +2,12 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.misc;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@Mixin(World.class)
|
@Mixin(World.class)
|
||||||
public abstract class WorldMixin {
|
public abstract class WorldMixin {
|
||||||
@ModifyConstant(method = "func_147480_a",
|
@ModifyConstant(method = "func_147480_a",
|
||||||
|
|||||||
+26
-24
@@ -1,55 +1,59 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Mixin(PacketBuffer.class)
|
@Mixin(PacketBuffer.class)
|
||||||
public abstract class PacketBufferMixin {
|
public abstract class PacketBufferMixin {
|
||||||
|
|
||||||
@Shadow public abstract int readInt();
|
@Shadow
|
||||||
|
public abstract int readInt();
|
||||||
|
|
||||||
@Shadow public abstract short readShort();
|
@Shadow
|
||||||
|
public abstract short readShort();
|
||||||
|
|
||||||
@Shadow public abstract byte readByte();
|
@Shadow
|
||||||
|
public abstract byte readByte();
|
||||||
|
|
||||||
@Shadow public abstract NBTTagCompound readNBTTagCompoundFromBuffer() throws IOException;
|
@Shadow
|
||||||
|
public abstract NBTTagCompound readNBTTagCompoundFromBuffer() throws IOException;
|
||||||
|
|
||||||
@Shadow public abstract ByteBuf writeInt(int p_writeInt_1_);
|
@Shadow
|
||||||
|
public abstract ByteBuf writeInt(int p_writeInt_1_);
|
||||||
|
|
||||||
@Shadow public abstract ByteBuf writeByte(int p_writeByte_1_);
|
@Shadow
|
||||||
|
public abstract ByteBuf writeByte(int p_writeByte_1_);
|
||||||
|
|
||||||
@Shadow public abstract ByteBuf writeShort(int p_writeShort_1_);
|
@Shadow
|
||||||
|
public abstract ByteBuf writeShort(int p_writeShort_1_);
|
||||||
|
|
||||||
@Shadow public abstract void writeNBTTagCompoundToBuffer(NBTTagCompound p_150786_1_) throws IOException;
|
@Shadow
|
||||||
|
public abstract void writeNBTTagCompoundToBuffer(NBTTagCompound p_150786_1_) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author FalsePattern
|
* @author FalsePattern
|
||||||
* @reason ID extension
|
* @reason ID extension
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public void writeItemStackToBuffer(ItemStack p_150788_1_) throws IOException
|
public void writeItemStackToBuffer(ItemStack p_150788_1_) throws IOException {
|
||||||
{
|
if (p_150788_1_ == null) {
|
||||||
if (p_150788_1_ == null)
|
|
||||||
{
|
|
||||||
this.writeInt(-1);
|
this.writeInt(-1);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
this.writeInt(Item.getIdFromItem(p_150788_1_.getItem()));
|
this.writeInt(Item.getIdFromItem(p_150788_1_.getItem()));
|
||||||
this.writeByte(p_150788_1_.stackSize);
|
this.writeByte(p_150788_1_.stackSize);
|
||||||
this.writeShort(p_150788_1_.getItemDamage());
|
this.writeShort(p_150788_1_.getItemDamage());
|
||||||
NBTTagCompound nbttagcompound = null;
|
NBTTagCompound nbttagcompound = null;
|
||||||
|
|
||||||
if (p_150788_1_.getItem().isDamageable() || p_150788_1_.getItem().getShareTag())
|
if (p_150788_1_.getItem().isDamageable() || p_150788_1_.getItem().getShareTag()) {
|
||||||
{
|
|
||||||
nbttagcompound = p_150788_1_.stackTagCompound;
|
nbttagcompound = p_150788_1_.stackTagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,13 +66,11 @@ public abstract class PacketBufferMixin {
|
|||||||
* @reason ID extension
|
* @reason ID extension
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public ItemStack readItemStackFromBuffer() throws IOException
|
public ItemStack readItemStackFromBuffer() throws IOException {
|
||||||
{
|
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
int id = this.readInt();
|
int id = this.readInt();
|
||||||
|
|
||||||
if (id >= 0)
|
if (id >= 0) {
|
||||||
{
|
|
||||||
byte b0 = this.readByte();
|
byte b0 = this.readByte();
|
||||||
short damage = this.readShort();
|
short damage = this.readShort();
|
||||||
itemstack = new ItemStack(Item.getItemById(id), b0, damage);
|
itemstack = new ItemStack(Item.getItemById(id), b0, damage);
|
||||||
|
|||||||
+20
-9
@@ -3,15 +3,18 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
|||||||
import com.falsepattern.endlessids.Hooks;
|
import com.falsepattern.endlessids.Hooks;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
import net.minecraft.network.play.server.S21PacketChunkData;
|
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.network.play.server.S21PacketChunkData;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
@Mixin(S21PacketChunkData.class)
|
@Mixin(S21PacketChunkData.class)
|
||||||
public abstract class S21PacketChunkDataMixin {
|
public abstract class S21PacketChunkDataMixin {
|
||||||
|
|
||||||
@@ -22,13 +25,6 @@ public abstract class S21PacketChunkDataMixin {
|
|||||||
return ExtendedConstants.bytesPerChunk;
|
return ExtendedConstants.bytesPerChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = "readPacketData",
|
|
||||||
constant = @Constant(intValue = VanillaConstants.bytesPerEBS),
|
|
||||||
require = 1)
|
|
||||||
private int increaseReadSize(int constant) {
|
|
||||||
return ExtendedConstants.bytesPerEBS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(method = "func_149269_a",
|
@Redirect(method = "func_149269_a",
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B"),
|
target = "Lnet/minecraft/world/chunk/storage/ExtendedBlockStorage;getBlockLSBArray()[B"),
|
||||||
@@ -36,4 +32,19 @@ public abstract class S21PacketChunkDataMixin {
|
|||||||
private static byte[] hookGetBlockData(ExtendedBlockStorage instance) {
|
private static byte[] hookGetBlockData(ExtendedBlockStorage instance) {
|
||||||
return Hooks.getBlockData((IExtendedBlockStorageMixin) 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ModifyConstant(method = "readPacketData",
|
||||||
|
constant = @Constant(intValue = VanillaConstants.bytesPerEBS),
|
||||||
|
require = 1)
|
||||||
|
private int increaseReadSize(int constant) {
|
||||||
|
return ExtendedConstants.bytesPerEBS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+9
-6
@@ -1,29 +1,32 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.network.play.server.S22PacketMultiBlockChange;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@Mixin(S22PacketMultiBlockChange.class)
|
@Mixin(S22PacketMultiBlockChange.class)
|
||||||
public abstract class S22PacketMultiBlockChangeMixin {
|
public abstract class S22PacketMultiBlockChangeMixin {
|
||||||
|
private int id;
|
||||||
|
private int meta;
|
||||||
|
|
||||||
//TODO magic number
|
//TODO magic number
|
||||||
@ModifyConstant(method = "<init>(I[SLnet/minecraft/world/chunk/Chunk;)V",
|
@ModifyConstant(method = "<init>(I[SLnet/minecraft/world/chunk/Chunk;)V",
|
||||||
constant = @Constant(intValue = 4, ordinal = 0),
|
constant = @Constant(intValue = 4,
|
||||||
|
ordinal = 0),
|
||||||
require = 1)
|
require = 1)
|
||||||
private int extend1(int constant) {
|
private int extend1(int constant) {
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int id;
|
|
||||||
private int meta;
|
|
||||||
@Redirect(method = "<init>(I[SLnet/minecraft/world/chunk/Chunk;)V",
|
@Redirect(method = "<init>(I[SLnet/minecraft/world/chunk/Chunk;)V",
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/chunk/Chunk;getBlock(III)Lnet/minecraft/block/Block;"),
|
target = "Lnet/minecraft/world/chunk/Chunk;getBlock(III)Lnet/minecraft/block/Block;"),
|
||||||
|
|||||||
+2
-1
@@ -2,11 +2,12 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.network.play.server.S24PacketBlockAction;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.network.play.server.S24PacketBlockAction;
|
||||||
|
|
||||||
@Mixin(S24PacketBlockAction.class)
|
@Mixin(S24PacketBlockAction.class)
|
||||||
public abstract class S24PacketBlockActionMixin {
|
public abstract class S24PacketBlockActionMixin {
|
||||||
@ModifyConstant(method = {"readPacketData", "writePacketData"},
|
@ModifyConstant(method = {"readPacketData", "writePacketData"},
|
||||||
|
|||||||
+11
-4
@@ -2,18 +2,25 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.networking;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
import net.minecraft.network.play.server.S26PacketMapChunkBulk;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.Constant;
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.network.play.server.S26PacketMapChunkBulk;
|
||||||
|
|
||||||
@Mixin(S26PacketMapChunkBulk.class)
|
@Mixin(S26PacketMapChunkBulk.class)
|
||||||
public abstract class S26PacketMapChunkBulkMixin {
|
public abstract class S26PacketMapChunkBulkMixin {
|
||||||
//TODO magic number
|
|
||||||
@ModifyConstant(method = "readPacketData",
|
@ModifyConstant(method = "readPacketData",
|
||||||
constant = @Constant(intValue = VanillaConstants.bytesPerIDPlusMetadata * 0x1000),
|
constant = @Constant(intValue = VanillaConstants.bytesPerIDPlusMetadata * 16 * 16 * 16),
|
||||||
require = 1)
|
require = 1)
|
||||||
private int extend1(int constant) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-19
@@ -2,6 +2,9 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.storage;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.Hooks;
|
import com.falsepattern.endlessids.Hooks;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -13,8 +16,6 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
import net.minecraft.world.chunk.NibbleArray;
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
|
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -28,7 +29,7 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
private void writeChunkToNBT(Chunk p_75820_1_, World p_75820_2_, NBTTagCompound p_75820_3_) {
|
private void writeChunkToNBT(Chunk p_75820_1_, World p_75820_2_, NBTTagCompound p_75820_3_) {
|
||||||
p_75820_3_.setByte("V", (byte)1);
|
p_75820_3_.setByte("V", (byte) 1);
|
||||||
p_75820_3_.setInteger("xPos", p_75820_1_.xPosition);
|
p_75820_3_.setInteger("xPos", p_75820_1_.xPosition);
|
||||||
p_75820_3_.setInteger("zPos", p_75820_1_.zPosition);
|
p_75820_3_.setInteger("zPos", p_75820_1_.zPosition);
|
||||||
p_75820_3_.setLong("LastUpdate", p_75820_2_.getTotalWorldTime());
|
p_75820_3_.setLong("LastUpdate", p_75820_2_.getTotalWorldTime());
|
||||||
@@ -43,11 +44,11 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
int var8 = var4.length;
|
int var8 = var4.length;
|
||||||
|
|
||||||
NBTTagCompound var11;
|
NBTTagCompound var11;
|
||||||
for(int var9 = 0; var9 < var8; ++var9) {
|
for (int var9 = 0; var9 < var8; ++var9) {
|
||||||
ExtendedBlockStorage var10 = var7[var9];
|
ExtendedBlockStorage var10 = var7[var9];
|
||||||
if (var10 != null) {
|
if (var10 != null) {
|
||||||
var11 = new NBTTagCompound();
|
var11 = new NBTTagCompound();
|
||||||
var11.setByte("Y", (byte)(var10.getYLocation() >> 4 & 255));
|
var11.setByte("Y", (byte) (var10.getYLocation() >> 4 & 255));
|
||||||
Hooks.writeChunkToNbt(var11, (IExtendedBlockStorageMixin) var10);
|
Hooks.writeChunkToNbt(var11, (IExtendedBlockStorageMixin) var10);
|
||||||
|
|
||||||
var11.setByteArray("Data", var10.getMetadataArray().data);
|
var11.setByteArray("Data", var10.getMetadataArray().data);
|
||||||
@@ -63,16 +64,16 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
p_75820_3_.setTag("Sections", var5);
|
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;
|
p_75820_1_.hasEntities = false;
|
||||||
NBTTagList var21 = new NBTTagList();
|
NBTTagList var21 = new NBTTagList();
|
||||||
|
|
||||||
Iterator var22;
|
Iterator var22;
|
||||||
for(var8 = 0; var8 < p_75820_1_.entityLists.length; ++var8) {
|
for (var8 = 0; var8 < p_75820_1_.entityLists.length; ++var8) {
|
||||||
var22 = p_75820_1_.entityLists[var8].iterator();
|
var22 = p_75820_1_.entityLists[var8].iterator();
|
||||||
|
|
||||||
while(var22.hasNext()) {
|
while (var22.hasNext()) {
|
||||||
Entity var12 = (Entity)var22.next();
|
Entity var12 = (Entity) var22.next();
|
||||||
var11 = new NBTTagCompound();
|
var11 = new NBTTagCompound();
|
||||||
if (var12.writeToNBTOptional(var11)) {
|
if (var12.writeToNBTOptional(var11)) {
|
||||||
p_75820_1_.hasEntities = true;
|
p_75820_1_.hasEntities = true;
|
||||||
@@ -85,8 +86,8 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
NBTTagList var23 = new NBTTagList();
|
NBTTagList var23 = new NBTTagList();
|
||||||
var22 = p_75820_1_.chunkTileEntityMap.values().iterator();
|
var22 = p_75820_1_.chunkTileEntityMap.values().iterator();
|
||||||
|
|
||||||
while(var22.hasNext()) {
|
while (var22.hasNext()) {
|
||||||
TileEntity var13 = (TileEntity)var22.next();
|
TileEntity var13 = (TileEntity) var22.next();
|
||||||
var11 = new NBTTagCompound();
|
var11 = new NBTTagCompound();
|
||||||
var13.writeToNBT(var11);
|
var13.writeToNBT(var11);
|
||||||
var23.appendTag(var11);
|
var23.appendTag(var11);
|
||||||
@@ -99,14 +100,14 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
NBTTagList var17 = new NBTTagList();
|
NBTTagList var17 = new NBTTagList();
|
||||||
Iterator var18 = var24.iterator();
|
Iterator var18 = var24.iterator();
|
||||||
|
|
||||||
while(var18.hasNext()) {
|
while (var18.hasNext()) {
|
||||||
NextTickListEntry var19 = (NextTickListEntry)var18.next();
|
NextTickListEntry var19 = (NextTickListEntry) var18.next();
|
||||||
NBTTagCompound var20 = new NBTTagCompound();
|
NBTTagCompound var20 = new NBTTagCompound();
|
||||||
var20.setInteger("i", Block.getIdFromBlock(var19.func_151351_a()));
|
var20.setInteger("i", Block.getIdFromBlock(var19.func_151351_a()));
|
||||||
var20.setInteger("x", var19.xCoord);
|
var20.setInteger("x", var19.xCoord);
|
||||||
var20.setInteger("y", var19.yCoord);
|
var20.setInteger("y", var19.yCoord);
|
||||||
var20.setInteger("z", var19.zCoord);
|
var20.setInteger("z", var19.zCoord);
|
||||||
var20.setInteger("t", (int)(var19.scheduledTime - var15));
|
var20.setInteger("t", (int) (var19.scheduledTime - var15));
|
||||||
var20.setInteger("p", var19.priority);
|
var20.setInteger("p", var19.priority);
|
||||||
var17.appendTag(var20);
|
var17.appendTag(var20);
|
||||||
}
|
}
|
||||||
@@ -134,7 +135,7 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
ExtendedBlockStorage[] var8 = new ExtendedBlockStorage[var7];
|
ExtendedBlockStorage[] var8 = new ExtendedBlockStorage[var7];
|
||||||
boolean var9 = !p_75823_1_.provider.hasNoSky;
|
boolean var9 = !p_75823_1_.provider.hasNoSky;
|
||||||
|
|
||||||
for(int var10 = 0; var10 < var6.tagCount(); ++var10) {
|
for (int var10 = 0; var10 < var6.tagCount(); ++var10) {
|
||||||
NBTTagCompound var11 = var6.getCompoundTagAt(var10);
|
NBTTagCompound var11 = var6.getCompoundTagAt(var10);
|
||||||
byte var12 = var11.getByte("Y");
|
byte var12 = var11.getByte("Y");
|
||||||
ExtendedBlockStorage var13 = new ExtendedBlockStorage(var12 << 4, var9);
|
ExtendedBlockStorage var13 = new ExtendedBlockStorage(var12 << 4, var9);
|
||||||
@@ -150,10 +151,7 @@ public abstract class AnvilChunkLoaderMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var5.setStorageArrays(var8);
|
var5.setStorageArrays(var8);
|
||||||
if (p_75823_2_.hasKey("Biomes", 7)) {
|
Hooks.readChunkBiomeArrayFromNbt(var5, p_75823_2_);
|
||||||
var5.setBiomeArray(p_75823_2_.getByteArray("Biomes"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return var5;
|
return var5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+99
@@ -0,0 +1,99 @@
|
|||||||
|
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 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 net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.biome.WorldChunkManager;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Mixin(value = Chunk.class,
|
||||||
|
priority = 900)
|
||||||
|
public abstract class ChunkMixin implements IChunkMixin {
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
public int xPosition;
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
public int zPosition;
|
||||||
|
@Shadow
|
||||||
|
public World worldObj;
|
||||||
|
@Shadow
|
||||||
|
private byte[] blockBiomeArray;
|
||||||
|
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) {
|
||||||
|
//Source: https://github.com/embeddedt/ArchaicFix/blob/3d1392f4db5a7221534a6f9b00c0c36a49d9be59/src/main/java/org/embeddedt/archaicfix/mixins/common/core/MixinChunk.java#L52
|
||||||
|
if (this.worldObj.isRemote) {
|
||||||
|
return BiomeGenBase.ocean;
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-7
@@ -2,9 +2,6 @@ package com.falsepattern.endlessids.mixin.mixins.common.vanilla.storage;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.Hooks;
|
import com.falsepattern.endlessids.Hooks;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
@@ -12,10 +9,16 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
@Mixin(ExtendedBlockStorage.class)
|
@Mixin(ExtendedBlockStorage.class)
|
||||||
public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorageMixin {
|
public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorageMixin {
|
||||||
@Shadow private int blockRefCount;
|
@Shadow
|
||||||
@Shadow private int tickRefCount;
|
private int blockRefCount;
|
||||||
|
@Shadow
|
||||||
|
private int tickRefCount;
|
||||||
private short[] lsbArray;
|
private short[] lsbArray;
|
||||||
private byte[] msbArray;
|
private byte[] msbArray;
|
||||||
|
|
||||||
@@ -58,8 +61,8 @@ public abstract class ExtendedBlockStorageMixin implements IExtendedBlockStorage
|
|||||||
int index = y << 8 | z << 4 | x;
|
int index = y << 8 | z << 4 | x;
|
||||||
int lsb = id & 0xFFFF;
|
int lsb = id & 0xFFFF;
|
||||||
int msb = (id >>> 16) & 0xFF;
|
int msb = (id >>> 16) & 0xFF;
|
||||||
lsbArray[index] = (short)lsb;
|
lsbArray[index] = (short) lsb;
|
||||||
msbArray[index] = (byte)msb;
|
msbArray[index] = (byte) msb;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+21
-23
@@ -1,38 +1,39 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.storage;
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.storage;
|
||||||
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
@Mixin(ItemStack.class)
|
@Mixin(ItemStack.class)
|
||||||
public abstract class ItemStackMixin {
|
public abstract class ItemStackMixin {
|
||||||
|
|
||||||
@Shadow private Item field_151002_e;
|
@Shadow
|
||||||
|
public int stackSize;
|
||||||
|
@Shadow
|
||||||
|
public NBTTagCompound stackTagCompound;
|
||||||
|
@Shadow
|
||||||
|
int itemDamage;
|
||||||
|
@Shadow
|
||||||
|
private Item field_151002_e;
|
||||||
|
|
||||||
@Shadow public int stackSize;
|
@Shadow
|
||||||
|
public abstract void func_150996_a(Item p_150996_1_);
|
||||||
@Shadow int itemDamage;
|
|
||||||
|
|
||||||
@Shadow public NBTTagCompound stackTagCompound;
|
|
||||||
|
|
||||||
@Shadow public abstract void func_150996_a(Item p_150996_1_);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author FalsePattern
|
* @author FalsePattern
|
||||||
* @reason ID extension
|
* @reason ID extension
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt)
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||||
{
|
|
||||||
nbt.setInteger("id", Item.getIdFromItem(this.field_151002_e));
|
nbt.setInteger("id", Item.getIdFromItem(this.field_151002_e));
|
||||||
nbt.setByte("Count", (byte)this.stackSize);
|
nbt.setByte("Count", (byte) this.stackSize);
|
||||||
nbt.setShort("Damage", (short)this.itemDamage);
|
nbt.setShort("Damage", (short) this.itemDamage);
|
||||||
|
|
||||||
if (this.stackTagCompound != null)
|
if (this.stackTagCompound != null) {
|
||||||
{
|
|
||||||
nbt.setTag("tag", this.stackTagCompound);
|
nbt.setTag("tag", this.stackTagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,19 +45,16 @@ public abstract class ItemStackMixin {
|
|||||||
* @reason ID extension
|
* @reason ID extension
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public void readFromNBT(NBTTagCompound nbt)
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
{
|
|
||||||
func_150996_a(Item.getItemById(nbt.getInteger("id")));
|
func_150996_a(Item.getItemById(nbt.getInteger("id")));
|
||||||
this.stackSize = nbt.getByte("Count");
|
this.stackSize = nbt.getByte("Count");
|
||||||
this.itemDamage = nbt.getShort("Damage");
|
this.itemDamage = nbt.getShort("Damage");
|
||||||
|
|
||||||
if (this.itemDamage < 0)
|
if (this.itemDamage < 0) {
|
||||||
{
|
|
||||||
this.itemDamage = 0;
|
this.itemDamage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbt.hasKey("tag", 10))
|
if (nbt.hasKey("tag", 10)) {
|
||||||
{
|
|
||||||
this.stackTagCompound = nbt.getCompoundTag("tag");
|
this.stackTagCompound = nbt.getCompoundTag("tag");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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 net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.gen.ChunkProviderEnd;
|
||||||
|
|
||||||
|
@Mixin(ChunkProviderEnd.class)
|
||||||
|
public abstract class ChunkProviderEndMixin {
|
||||||
|
@Shadow
|
||||||
|
private BiomeGenBase[] biomesForGeneration;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
import net.minecraft.world.gen.ChunkProviderFlat;
|
||||||
|
|
||||||
|
@Mixin(ChunkProviderFlat.class)
|
||||||
|
public abstract class ChunkProviderFlatMixin implements IChunkProvider {
|
||||||
|
private BiomeGenBase[] bgb;
|
||||||
|
|
||||||
|
@Inject(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
shift = At.Shift.BEFORE),
|
||||||
|
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||||
|
require = 1)
|
||||||
|
private void setBiomesTweaked1(int p_73154_1_, int p_73154_2_, CallbackInfoReturnable<Chunk> cir, Chunk chunk, BiomeGenBase[] abiomegenbase) {
|
||||||
|
bgb = abiomegenbase;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked2(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
|
||||||
|
} finally {
|
||||||
|
bgb = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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 net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
import net.minecraft.world.gen.ChunkProviderGenerate;
|
||||||
|
|
||||||
|
@Mixin(ChunkProviderGenerate.class)
|
||||||
|
public abstract class ChunkProviderGenerateMixin implements IChunkProvider {
|
||||||
|
@Shadow
|
||||||
|
private BiomeGenBase[] biomesForGeneration;
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, biomesForGeneration);
|
||||||
|
}
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.vanilla.worldgen;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.IChunkProvider;
|
||||||
|
import net.minecraft.world.gen.ChunkProviderHell;
|
||||||
|
|
||||||
|
@Mixin(ChunkProviderHell.class)
|
||||||
|
public abstract class ChunkProviderHellMixin implements IChunkProvider {
|
||||||
|
private BiomeGenBase[] bgb;
|
||||||
|
|
||||||
|
@Inject(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
|
shift = At.Shift.BEFORE),
|
||||||
|
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||||
|
require = 1)
|
||||||
|
private void setBiomesTweaked1(int p_73154_1_, int p_73154_2_, CallbackInfoReturnable<Chunk> cir, Block[] ablock, byte[] meta, BiomeGenBase[] abiomegenbase, Chunk chunk) {
|
||||||
|
bgb = abiomegenbase;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "provideChunk",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B"),
|
||||||
|
require = 1)
|
||||||
|
private byte[] setBiomesTweaked2(Chunk chunk) {
|
||||||
|
try {
|
||||||
|
return BiomePatchHelper.getBiomeArrayTweaked(chunk, bgb);
|
||||||
|
} finally {
|
||||||
|
bgb = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -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 org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.world.gen.layer.GenLayerRiverMix;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+19
@@ -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 org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.world.gen.layer.GenLayerVoronoiZoom;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-2
@@ -5,7 +5,8 @@ import com.sk89q.worldedit.blocks.BaseBlock;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
@Mixin(value = BaseBlock.class, remap = false)
|
@Mixin(value = BaseBlock.class,
|
||||||
|
remap = false)
|
||||||
public abstract class BaseBlockMixin {
|
public abstract class BaseBlockMixin {
|
||||||
private int idExtended;
|
private int idExtended;
|
||||||
|
|
||||||
@@ -16,7 +17,8 @@ public abstract class BaseBlockMixin {
|
|||||||
@Overwrite
|
@Overwrite
|
||||||
protected final void internalSetId(int id) {
|
protected final void internalSetId(int id) {
|
||||||
if (id > ExtendedConstants.maxBlockID) {
|
if (id > ExtendedConstants.maxBlockID) {
|
||||||
throw new IllegalArgumentException("Can't have a block ID above " + ExtendedConstants.maxBlockID + " (" + id + " given)");
|
throw new IllegalArgumentException(
|
||||||
|
"Can't have a block ID above " + ExtendedConstants.maxBlockID + " (" + id + " given)");
|
||||||
} else if (id < 0) {
|
} else if (id < 0) {
|
||||||
throw new IllegalArgumentException("Can't have a block ID below 0");
|
throw new IllegalArgumentException("Can't have a block ID below 0");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -9,55 +9,133 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.*;
|
import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.always;
|
||||||
|
import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.avoid;
|
||||||
|
import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.condition;
|
||||||
|
import static com.falsepattern.lib.mixin.IMixin.PredicateHelpers.require;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public enum Mixin implements IMixin {
|
public enum Mixin implements IMixin {
|
||||||
//region Minecraft
|
//region Minecraft
|
||||||
//region common
|
//region Minecraft->common
|
||||||
//region storage
|
//region Minecraft->common->storage
|
||||||
AnvilChunkLoaderMixin(Side.COMMON, always(), "vanilla.storage.AnvilChunkLoaderMixin"),
|
AnvilChunkLoaderMixin(Side.COMMON, always(), "vanilla.storage.AnvilChunkLoaderMixin"),
|
||||||
ExtendedBlockStorageMixin(Side.COMMON, always(), "vanilla.storage.ExtendedBlockStorageMixin"),
|
ChunkMixin(Side.COMMON, always(), "vanilla.storage.ChunkMixin"),
|
||||||
ItemStackMixin(Side.COMMON, always(), "vanilla.storage.ItemStackMixin"),
|
ExtendedBlockStorageMixin(Side.COMMON, always(), "vanilla.storage.ExtendedBlockStorageMixin"),
|
||||||
//endregion storage
|
ItemStackMixin(Side.COMMON, always(), "vanilla.storage.ItemStackMixin"),
|
||||||
//region networking
|
//endregion Minecraft->common->storage
|
||||||
PacketBufferMixin(Side.COMMON, always(), "vanilla.networking.PacketBufferMixin"),
|
//region Minecraft->common->networking
|
||||||
S21PacketChunkDataMixin(Side.COMMON, always(), "vanilla.networking.S21PacketChunkDataMixin"),
|
PacketBufferMixin(Side.COMMON, always(), "vanilla.networking.PacketBufferMixin"),
|
||||||
S22PacketMultiBlockChangeMixin(Side.COMMON, always(), "vanilla.networking.S22PacketMultiBlockChangeMixin"),
|
S21PacketChunkDataMixin(Side.COMMON, always(), "vanilla.networking.S21PacketChunkDataMixin"),
|
||||||
S24PacketBlockActionMixin(Side.COMMON, always(), "vanilla.networking.S24PacketBlockActionMixin"),
|
S22PacketMultiBlockChangeMixin(Side.COMMON, always(), "vanilla.networking.S22PacketMultiBlockChangeMixin"),
|
||||||
S26PacketMapChunkBulkMixin(Side.COMMON, always(), "vanilla.networking.S26PacketMapChunkBulkMixin"),
|
S24PacketBlockActionMixin(Side.COMMON, always(), "vanilla.networking.S24PacketBlockActionMixin"),
|
||||||
//endregion networking
|
S26PacketMapChunkBulkMixin(Side.COMMON, always(), "vanilla.networking.S26PacketMapChunkBulkMixin"),
|
||||||
//region misc
|
//endregion Minecraft->common->networking
|
||||||
BlockFireMixin(Side.COMMON, always(), "vanilla.misc.BlockFireMixin"),
|
//region Minecraft->common->biome
|
||||||
DataWatcherMixin(Side.COMMON, condition(() -> IEConfig.extendDataWatcher), "vanilla.misc.DataWatcherMixin"),
|
BiomeDictionaryMixin(Side.COMMON, always(), "vanilla.biome.BiomeDictionaryMixin"),
|
||||||
ItemInWorldManagerMixin(Side.COMMON, always(), "vanilla.misc.ItemInWorldManagerMixin"),
|
BiomeGenBaseMixin(Side.COMMON, always(), "vanilla.biome.BiomeGenBaseMixin"),
|
||||||
StatListMixin(Side.COMMON, always(), "vanilla.misc.StatListMixin"),
|
//endregion Minecraft->common->biome
|
||||||
WorldMixin(Side.COMMON, always(), "vanilla.misc.WorldMixin"),
|
//region Minecraft->common->misc
|
||||||
//endregion misc
|
BlockFireMixin(Side.COMMON, always(), "vanilla.misc.BlockFireMixin"),
|
||||||
//endregion common
|
DataWatcherMixin(Side.COMMON, condition(() -> IEConfig.extendDataWatcher), "vanilla.misc.DataWatcherMixin"),
|
||||||
//region client
|
ItemInWorldManagerMixin(Side.COMMON, always(), "vanilla.misc.ItemInWorldManagerMixin"),
|
||||||
ChunkMixin(Side.CLIENT, always(), "vanilla.ChunkMixin"),
|
StatListMixin(Side.COMMON, always(), "vanilla.misc.StatListMixin"),
|
||||||
NetHandlerPlayClientMixin(Side.CLIENT, always(), "vanilla.NetHandlerPlayClientMixin"),
|
WorldMixin(Side.COMMON, always(), "vanilla.misc.WorldMixin"),
|
||||||
PlayerControllerMPMixin(Side.CLIENT, always(), "vanilla.PlayerControllerMPMixin"),
|
//endregion Minecraft->common->misc
|
||||||
RenderGlobalMixin(Side.CLIENT, always(), "vanilla.RenderGlobalMixin"),
|
//region Minecraft->common->worldgen
|
||||||
//endregion client
|
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, avoid(TargetedMod.DRAGONAPI), "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
|
//endregion Minecraft
|
||||||
//region UBC->common
|
//region AntiIDConflict->common
|
||||||
OreUBifierMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.OreUBifierMixin"),
|
AIDCAntiIdConflictBaseMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
|
||||||
BiomeUndergroundDecoratorMixin(Side.COMMON, require(TargetedMod.UBC), "ubc.BiomeUndergroundDecoratorMixin"),
|
"antiidconflict.AntiIdConflictBaseMixin"),
|
||||||
//endregion UBC->common
|
AIDCBiomesGenBasePlaceholderMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
|
||||||
|
"antiidconflict.BiomeGenBasePlaceholderMixin"),
|
||||||
|
AIDCBiomesManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.BiomesManagerMixin"),
|
||||||
|
AIDCDimensionsManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
|
||||||
|
"antiidconflict.DimensionsManagerMixin"),
|
||||||
|
AIDCEnchantementsManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT),
|
||||||
|
"antiidconflict.EnchantementsManagerMixin"),
|
||||||
|
AIDCEntitiesManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.EntitiesManagerMixin"),
|
||||||
|
AIDCPotionsManagerMixin(Side.COMMON, require(TargetedMod.ANTIIDCONFLICT), "antiidconflict.PotionsManagerMixin"),
|
||||||
|
//endregion AntiIDConflict->common
|
||||||
|
//region AntiqueAtlas->commond
|
||||||
|
BiomeDetectorBaseMixin(Side.COMMON, require(TargetedMod.ANTIQUEATLAS), "antiqueatlas.BiomeDetectorBaseMixin"),
|
||||||
|
BiomeDetectorNetherMixin(Side.COMMON, require(TargetedMod.ANTIQUEATLAS), "antiqueatlas.BiomeDetectorNetherMixin"),
|
||||||
|
//endregion AntiqueAtlas->commond
|
||||||
|
//region ATG->common
|
||||||
|
ATGBiomeConfigMixin(Side.COMMON, require(TargetedMod.ATG), "atg.ATGBiomeConfigMixin"),
|
||||||
|
ATGBiomeManagerMixin(Side.COMMON, require(TargetedMod.ATG), "atg.ATGBiomeManagerMixin"),
|
||||||
|
ATGChunkProviderMixin(Side.COMMON, require(TargetedMod.ATG), "atg.ATGChunkProviderMixin"),
|
||||||
|
ATGWorldGenRocksMixin(Side.COMMON, require(TargetedMod.ATG), "atg.ATGWorldGenRocksMixin"),
|
||||||
|
//endregion ATG->common
|
||||||
|
//region BoP->common
|
||||||
|
BOPBiomeManagerMixin(Side.COMMON, require(TargetedMod.BOP), "bop.BOPBiomeManagerMixin"),
|
||||||
|
ChunkProviderBOPEndMixin(Side.COMMON, require(TargetedMod.BOP), "bop.ChunkProviderBOPEndMixin"),
|
||||||
|
ChunkProviderBOPHellMixin(Side.COMMON, require(TargetedMod.BOP), "bop.ChunkProviderBOPHellMixin"),
|
||||||
|
//endregion BoP->common
|
||||||
//region CoFHLib->common
|
//region CoFHLib->common
|
||||||
CofhBlockHelperMixin(Side.COMMON, require(TargetedMod.COFHLIB), "cofhlib.BlockHelperMixin"),
|
CoFHLibCofhBlockHelperMixin(Side.COMMON, require(TargetedMod.COFHLIB), "cofhlib.BlockHelperMixin"),
|
||||||
//endregion CoFHLib->common
|
//endregion CoFHLib->common
|
||||||
//region DragonAPI->common
|
//region DragonAPI->common
|
||||||
BlockPropertiesMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.BlockPropertiesMixin"),
|
//region DragonAPI->common->vanilla
|
||||||
|
DragonAPIGenLayerRiverMixMixin(Side.COMMON, require(TargetedMod.DRAGONAPI),
|
||||||
|
"dragonapi.vanilla.GenLayerRiverMixMixin"),
|
||||||
|
//endregion DragonAPI->common->vanilla
|
||||||
|
DragonAPIGenLayerRiverEventMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.GenLayerRiverEventMixin"),
|
||||||
|
DragonAPIBlockPropertiesMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.BlockPropertiesMixin"),
|
||||||
|
DragonAPIIDTypeMixin(Side.COMMON, require(TargetedMod.DRAGONAPI), "dragonapi.IDTypeMixin"),
|
||||||
//endregion DragonAPI->common
|
//endregion DragonAPI->common
|
||||||
|
//region ExtraUtilities->common
|
||||||
|
ChunkProviderEndOfTimeMixin(Side.COMMON, require(TargetedMod.EXTRAUTILITIES), "extrautilities.ChunkProviderEndOfTimeMixin"),
|
||||||
|
ChunkProviderUnderdarkMixin(Side.COMMON, require(TargetedMod.EXTRAUTILITIES), "extrautilities.ChunkProviderUnderdarkMixin"),
|
||||||
|
//endregion ExtraUtilities->common
|
||||||
|
//region GalactiCraftCore->common
|
||||||
|
GalactiCraftCoreConfigManagerCoreMixin(Side.COMMON, require(TargetedMod.GALACTICRAFTCORE),
|
||||||
|
"galacticraft.ConfigManagerCoreMixin"),
|
||||||
|
//endregion GalactiCraftCore->common
|
||||||
|
//region ICG->common
|
||||||
|
ICGMysteriumPatchesFixesCaveMixin(Side.COMMON, require(TargetedMod.ICG), "icg.MysteriumPatchesFixesCaveMixin"),
|
||||||
|
//endregion ICG->common
|
||||||
//region MFQM->common
|
//region MFQM->common
|
||||||
MFQMMixin(Side.COMMON, require(TargetedMod.MFQM), "mfqm.MFQMMixin"),
|
MFQMMixin(Side.COMMON, require(TargetedMod.MFQM), "mfqm.MFQMMixin"),
|
||||||
MFQMDataWatcherMixin(Side.COMMON, require(TargetedMod.MFQM).and(condition(() -> IEConfig.extendDataWatcher)), "mfqm.MFQMDataWatcherMixin"),
|
MFQMDataWatcherMixin(Side.COMMON, require(TargetedMod.MFQM).and(condition(() -> IEConfig.extendDataWatcher)),
|
||||||
|
"mfqm.MFQMDataWatcherMixin"),
|
||||||
//endregion MFQM->common
|
//endregion MFQM->common
|
||||||
|
//region NaturesCompass->common
|
||||||
|
NaturesCompassBiomeUtilsMixin(Side.COMMON, require(TargetedMod.NATURESCOMPASS), "naturescompass.BiomeUtilsMixin"),
|
||||||
|
//endregion NaturesCompass->common
|
||||||
|
//region RTG->common
|
||||||
|
RTGChunkProviderRTGMixin(Side.COMMON, require(TargetedMod.RTG), "rtg.ChunkProviderRTGMixin"),
|
||||||
|
RTGLandscapeGeneratorMixin(Side.COMMON, require(TargetedMod.RTG), "rtg.LandscapeGeneratorMixin"),
|
||||||
|
RTGRealisticBiomeBaseMixin(Side.COMMON, require(TargetedMod.RTG), "rtg.RealisticBiomeBaseMixin"),
|
||||||
|
//endregion RTG->common
|
||||||
|
//region Thaumcraft->common
|
||||||
|
ThaumcraftUtilsMixin(Side.COMMON, require(TargetedMod.THAUMCRAFT), "thaumcraft.UtilsMixin"),
|
||||||
|
//endregion Thaumcraft->common
|
||||||
|
//region TwilightForest->common
|
||||||
|
ChunkProviderTwilightForestMixin(Side.COMMON, require(TargetedMod.TWILIGHTFOREST),
|
||||||
|
"twilightforest.ChunkProviderTwilightForestMixin"),
|
||||||
|
TFBiomeBaseMixin(Side.COMMON, require(TargetedMod.TWILIGHTFOREST), "twilightforest.TFBiomeBaseMixin"),
|
||||||
|
//endregion TwilightForest->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
|
//region WorldEdit->common
|
||||||
BaseBlockMixin(Side.COMMON, require(TargetedMod.WORLDEDIT), "worldedit.BaseBlockMixin"),
|
WorldEditBaseBlockMixin(Side.COMMON, require(TargetedMod.WORLDEDIT), "worldedit.BaseBlockMixin"),
|
||||||
//endregion WorldEdit->common
|
//endregion WorldEdit->common
|
||||||
;
|
;
|
||||||
@Getter
|
@Getter
|
||||||
|
|||||||
@@ -8,8 +8,10 @@ import lombok.Getter;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class MixinPlugin implements IMixinPlugin {
|
public class MixinPlugin implements IMixinPlugin {
|
||||||
|
public static final Logger LOG = IMixinPlugin.createLogger(Tags.MODNAME);
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Logger logger = IMixinPlugin.createLogger(Tags.MODNAME);
|
private final Logger logger = LOG;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IMixin[] getMixinEnumValues() {
|
public IMixin[] getMixinEnumValues() {
|
||||||
|
|||||||
@@ -6,15 +6,26 @@ import lombok.RequiredArgsConstructor;
|
|||||||
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import static com.falsepattern.lib.mixin.ITargetedMod.PredicateHelpers.*;
|
import static com.falsepattern.lib.mixin.ITargetedMod.PredicateHelpers.startsWith;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public enum TargetedMod implements ITargetedMod {
|
public enum TargetedMod implements ITargetedMod {
|
||||||
|
|
||||||
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
|
ANTIIDCONFLICT("Anti ID Conflict", true, startsWith("antiidconflict")),
|
||||||
COFHLIB("CoFH Lib", false, startsWith("cofhlib-")),
|
ANTIQUEATLAS("Antique Atlas", true, startsWith("antiqueatlas")),
|
||||||
|
ATG("Alternate Terrain Generation", true, startsWith("atg")),
|
||||||
|
BOP("Biomes O' Plenty", true, startsWith("biomesoplenty-")),
|
||||||
|
COFHLIB("CoFH Lib", true, startsWith("cofhlib-")),
|
||||||
DRAGONAPI("DragonAPI", false, startsWith("dragonapi")),
|
DRAGONAPI("DragonAPI", false, startsWith("dragonapi")),
|
||||||
|
EXTRAUTILITIES("Extra Utilities", true, startsWith("extrautilities-")),
|
||||||
|
GALACTICRAFTCORE("GalactiCraftCore", false, startsWith("galacticraftcore")),
|
||||||
|
ICG("Immersive Cavegen", true, startsWith("immersivecavegen")),
|
||||||
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
|
MFQM("More Fun Quicksand Mod", false, startsWith("morefunquicksandmod-")),
|
||||||
|
NATURESCOMPASS("Nature's Compass", true, startsWith("naturescompass")),
|
||||||
|
RTG("Realistic Terrain Generation", true, startsWith("rtg-")),
|
||||||
|
THAUMCRAFT("Thaumcraft", true, startsWith("thaumcraft")),
|
||||||
|
TWILIGHTFOREST("Twilight Forest", true, startsWith("twilightforest")),
|
||||||
|
UBC("Underground Biomes Constructs", false, startsWith("undergroundbiomesconstructs-")),
|
||||||
WORLDEDIT("WorldEdit", false, startsWith("worldedit-")),
|
WORLDEDIT("WorldEdit", false, startsWith("worldedit-")),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ the Free Software Foundation, either version 3 of the License, or
|
|||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
You should have received a copy of the GNU Lesser General Public License
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
@@ -1,16 +1,20 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"modid": "${modId}",
|
"modid": "${modId}",
|
||||||
"name": "${modName}",
|
"name": "${modName}",
|
||||||
"description": "Extends hardcoded block ID limit even more.",
|
"description": "Extends hardcoded block ID limit even more.",
|
||||||
"version": "${modVersion}",
|
"version": "${modVersion}",
|
||||||
"mcversion": "${minecraftVersion}",
|
"mcversion": "${minecraftVersion}",
|
||||||
"url": "https://github.com/FalsePattern/EndlessIDs",
|
"url": "https://github.com/FalsePattern/EndlessIDs",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
"authorList": ["fewizz","Player","FalsePattern"],
|
"authorList": [
|
||||||
"credits": "This mod is a modern rewrite of NotEnoughIDs, made by fewizz and Player, which was released under the MIT license.",
|
"fewizz",
|
||||||
"logoFile": "",
|
"Player",
|
||||||
"screenshots": [],
|
"FalsePattern"
|
||||||
"dependencies": []
|
],
|
||||||
}
|
"credits": "This mod is a modern rewrite of NotEnoughIDs, made by fewizz and Player, which was released under the MIT license.",
|
||||||
|
"logoFile": "",
|
||||||
|
"screenshots": [],
|
||||||
|
"dependencies": []
|
||||||
|
}
|
||||||
]
|
]
|
||||||
Reference in new issue
Block a user