mirror of
https://github.com/GTMEGA/EndlessIDs.git
synced 2026-11-25 09:54:33 +00:00
Compare commits
65
Commits
1.4.0
...
1.5-alpha0010
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1d8e273fc | ||
|
|
484a9175e7 | ||
|
|
1bb71d9448 | ||
|
|
11ff4a4a6a | ||
|
|
6b3d872fbd | ||
|
|
344b788108 | ||
|
|
b61711280b | ||
|
|
67badb8fcb | ||
|
|
e529ad49cb | ||
|
|
10c19feb0c | ||
|
|
fb0096350c | ||
|
|
1f726e42d3 | ||
|
|
1944aa08f1 | ||
|
|
0dfe4bfc2d | ||
|
|
fcac948f88 | ||
|
|
04fe960ca4 | ||
|
|
a1d13d833d | ||
|
|
8ae84392ba | ||
|
|
76092e5c4c | ||
|
|
0ecadb8563 | ||
|
|
147099d625 | ||
|
|
e699d67f4e | ||
|
|
6101766529 | ||
|
|
8c715bd579 | ||
|
|
e7340cd9b1 | ||
|
|
786652504c | ||
|
|
4ded45cc5c | ||
|
|
16be8d607c | ||
|
|
775ea5769c | ||
|
|
93e375a07d | ||
|
|
a2c0ac2d99 | ||
|
|
de5fa2d322 | ||
|
|
984c976b34 | ||
|
|
0e58bf113d | ||
|
|
0b968923df | ||
|
|
f98d2c98e3 | ||
|
|
bf52cfaadf | ||
|
|
c321707f0e | ||
|
|
c8e076f6d2 | ||
|
|
6f832f4905 | ||
|
|
818f201f30 | ||
|
|
b09565144f | ||
|
|
6fe932e136 | ||
|
|
06c44e3cb8 | ||
|
|
7c5652879f | ||
|
|
bbeaad3f3c | ||
|
|
268a95414c | ||
|
|
80e1f2754f | ||
|
|
a30a223b87 | ||
|
|
5bd48c168c | ||
|
|
7381139fdf | ||
|
|
3c78543a82 | ||
|
|
83227b76f2 | ||
|
|
8e22c69168 | ||
|
|
078cc110ff | ||
|
|
5c81a620e2 | ||
|
|
012fa8188c | ||
|
|
495c70223c | ||
|
|
7e97287004 | ||
|
|
ccb2c62a89 | ||
|
|
c65179a4b3 | ||
|
|
d825ea3c97 | ||
|
|
9d5d87fe81 | ||
|
|
8a3b75cf14 | ||
|
|
20d7738cc4 |
No files matched your search
@@ -145,3 +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
|
||||||
!lib/*.jar
|
!lib/*.jar
|
||||||
|
|
||||||
|
srgmap.cfg
|
||||||
Generated
+7
@@ -1,5 +1,6 @@
|
|||||||
<component name="ProjectCodeStyleConfiguration">
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
<code_scheme name="Project" version="173">
|
<code_scheme name="Project" version="173">
|
||||||
|
<option name="FORMATTER_TAGS_ENABLED" value="true" />
|
||||||
<JavaCodeStyleSettings>
|
<JavaCodeStyleSettings>
|
||||||
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
|
<option name="ANNOTATION_PARAMETER_WRAP" value="2" />
|
||||||
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
<option name="ALIGN_MULTILINE_ANNOTATION_PARAMETERS" value="true" />
|
||||||
@@ -25,6 +26,9 @@
|
|||||||
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
<option name="JD_ADD_BLANK_AFTER_PARM_COMMENTS" value="true" />
|
||||||
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
<option name="JD_ADD_BLANK_AFTER_RETURN" value="true" />
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="KEEP_LINE_BREAKS" value="false" />
|
<option name="KEEP_LINE_BREAKS" value="false" />
|
||||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||||
@@ -62,5 +66,8 @@
|
|||||||
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
||||||
<option name="WRAP_ON_TYPING" value="0" />
|
<option name="WRAP_ON_TYPING" value="0" />
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
</component>
|
</component>
|
||||||
@@ -3,7 +3,7 @@ EndlessIDs
|
|||||||
Copyright (C) 2022 FalsePattern
|
Copyright (C) 2022 FalsePattern
|
||||||
All Rights Reserved
|
All Rights Reserved
|
||||||
|
|
||||||
The above copyright notice, this permission notice and the word "SNEED"
|
The above copyright notice, this permission notice and the words "MEGA"
|
||||||
shall be included in all copies or substantial portions of the Software.
|
shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,17 +1,23 @@
|
|||||||
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
|
EndlessIDs is the unofficial successor of NotEnoughIDs, with more focus on compatibility, stability, and reaching
|
||||||
new limits.
|
new limits.
|
||||||
|
|
||||||
|
## REQUIRED MODS
|
||||||
|
- [FalsePatternLib](https://github.com/FalsePattern/FalsePatternLib)
|
||||||
|
- [GasStation](https://github.com/FalsePattern/GasStation)
|
||||||
|
- [ChunkAPI](https://github.com/FalsePattern/ChunkAPI)
|
||||||
|
|
||||||
Comparison of the known limits:
|
Comparison of the known limits:
|
||||||
|
|
||||||
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
| | Vanilla | NotEnoughIDs | EndlessIDs |
|
||||||
|-----------------|----------------------------------------------------|--------------|----------------------------------|
|
|-----------------|----------------------------------------------------|--------------|----------------------|
|
||||||
| Block IDs | 4,096 | 32,000 | 16,777,216 |
|
| Block IDs | 4,096 | 32,000 | 16,777,216 since 1.3 |
|
||||||
| Item IDs | 32,000 | 32,000 | 16,777,216 |
|
| Block Metadata | 16 | 16 | 65,536 since 1.5 |
|
||||||
| Biome IDs | 256 | 256 | 65,536 |
|
| Item IDs | 32,000 | 32,000 | 16,777,216 since 1.3 |
|
||||||
| Entity IDs | 256 | 256 | 256 right now, extension planned |
|
| Biome IDs | 256 | 256 | 65,536 since 1.4 |
|
||||||
| Potion IDs | 32 | 32 | 32 right now, extension planned |
|
| Entity IDs | 256 | 256 | 32,768 since 1.5 |
|
||||||
| Enchantment IDs | 256 | 256 | 256 right now, extension planned |
|
| Potion IDs | 32 | 32 | 65,536 since 1.5 |
|
||||||
| Dimension IDs | Theoretically unlimited, 4,294,967,295 in practice | Same | Same |
|
| Enchantment IDs | 256 | 256 | 32,768 since 1.5 |
|
||||||
|
| 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:
|
||||||
|
|
||||||
@@ -29,6 +35,7 @@ This mod also contains patches for the following mods:
|
|||||||
- Compact Machines
|
- Compact Machines
|
||||||
- CoFH Lib
|
- CoFH Lib
|
||||||
- Dark World
|
- Dark World
|
||||||
|
- Dimensional Doors
|
||||||
- DragonAPI
|
- DragonAPI
|
||||||
- Dynamic Surroundings
|
- Dynamic Surroundings
|
||||||
- Enderlicious
|
- Enderlicious
|
||||||
@@ -40,12 +47,13 @@ This mod also contains patches for the following mods:
|
|||||||
- GalactiCraft
|
- GalactiCraft
|
||||||
- Highlands
|
- Highlands
|
||||||
- Immersive Cavegen
|
- Immersive Cavegen
|
||||||
- LOTR
|
- Industrial Revolution by Redstone Rebooted
|
||||||
- More Fun Quicksand Mod
|
- More Fun Quicksand Mod
|
||||||
- Nature's Compass
|
- Nature's Compass
|
||||||
- Netherlicious
|
- Netherlicious
|
||||||
- Nomadic Tents
|
- Nomadic Tents
|
||||||
- Random Things
|
- Random Things
|
||||||
|
- Restructured
|
||||||
- Realistic Terrain Generation
|
- Realistic Terrain Generation
|
||||||
- Realistic World Generation
|
- Realistic World Generation
|
||||||
- Thaumcraft
|
- Thaumcraft
|
||||||
@@ -64,10 +72,6 @@ Mods not listed here may or may not work.
|
|||||||
- If a mod adds a custom world generator, it has a high chance of invoking an old vanilla method in the worldgen code.
|
- 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
|
To avoid world corruption and broken biomes, this method has been replaced with an instant crash that refers the
|
||||||
user to this github repo.
|
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.
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
- [FalsePatternLib](https://github.com/FalsePattern/FalsePatternLib)
|
|
||||||
- [GasStation](https://github.com/FalsePattern/GasStation)
|
|
||||||
+37
-11
@@ -1,4 +1,4 @@
|
|||||||
//version: 1656003793falsepattern58
|
//version: 1656003793falsepattern67
|
||||||
/*
|
/*
|
||||||
DO NOT CHANGE THIS FILE!
|
DO NOT CHANGE THIS FILE!
|
||||||
|
|
||||||
@@ -257,7 +257,9 @@ minecraft {
|
|||||||
runDir = "run"
|
runDir = "run"
|
||||||
|
|
||||||
if (replaceGradleTokenInFile) {
|
if (replaceGradleTokenInFile) {
|
||||||
replaceIn replaceGradleTokenInFile
|
for (file in replaceGradleTokenInFile.split(',')) {
|
||||||
|
replaceIn file
|
||||||
|
}
|
||||||
if(gradleTokenModId) {
|
if(gradleTokenModId) {
|
||||||
replace gradleTokenModId, modId
|
replace gradleTokenModId, modId
|
||||||
}
|
}
|
||||||
@@ -280,9 +282,13 @@ if(file("addon.gradle").exists()) {
|
|||||||
apply from: 'repositories.gradle'
|
apply from: 'repositories.gradle'
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
implementation.extendsFrom(shadowImplementation) // TODO: remove after all uses are refactored
|
for (config in [shadowImplementation, shadowCompile, shadeCompile]) {
|
||||||
implementation.extendsFrom(shadowCompile)
|
implementation.extendsFrom(shadeCompile)
|
||||||
implementation.extendsFrom(shadeCompile)
|
compileClasspath.extendsFrom(config)
|
||||||
|
runtimeClasspath.extendsFrom(config)
|
||||||
|
testCompileClasspath.extendsFrom(config)
|
||||||
|
testRuntimeClasspath.extendsFrom(config)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -312,11 +318,19 @@ dependencies {
|
|||||||
compile("org.spongepowered:mixin:0.8.5-gasstation_7")
|
compile("org.spongepowered:mixin:0.8.5-gasstation_7")
|
||||||
compile("com.llamalad7:MixinExtras:0.1.1-gasstation")
|
compile("com.llamalad7:MixinExtras:0.1.1-gasstation")
|
||||||
compile("com.falsepattern:00gasstation-mc1.7.10:0.5.1:dev")
|
compile("com.falsepattern:00gasstation-mc1.7.10:0.5.1:dev")
|
||||||
|
runtimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
|
||||||
|
testRuntimeClasspath('org.jetbrains:intellij-fernflower:1.2.1.16')
|
||||||
} else if(hasMixinDeps.toBoolean()) {
|
} else if(hasMixinDeps.toBoolean()) {
|
||||||
runtime("com.llamalad7:MixinExtras:0.1.1-gasstation")
|
runtime("com.llamalad7:MixinExtras:0.1.1-gasstation")
|
||||||
runtime("org.spongepowered:mixin:0.8.5-gasstation_7")
|
runtime("org.spongepowered:mixin:0.8.5-gasstation_7")
|
||||||
runtime("com.falsepattern:00gasstation-mc1.7.10:0.5.1:dev")
|
runtime("com.falsepattern:00gasstation-mc1.7.10:0.5.1:dev")
|
||||||
}
|
}
|
||||||
|
// Latest LWJGL
|
||||||
|
compile "org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209"
|
||||||
|
compile "org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209"
|
||||||
|
minecraftNatives "org.lwjgl.lwjgl:lwjgl-platform:2.9.4-nightly-20150209"
|
||||||
|
minecraftDeps "org.lwjgl.lwjgl:lwjgl:2.9.4-nightly-20150209"
|
||||||
|
minecraftDeps "org.lwjgl.lwjgl:lwjgl_util:2.9.4-nightly-20150209"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: 'dependencies.gradle'
|
apply from: 'dependencies.gradle'
|
||||||
@@ -656,12 +670,18 @@ def getCredentials = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Publishing
|
//Publishing
|
||||||
publish.dependsOn(build)
|
tasks.publish.dependsOn(build)
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
maven(MavenPublication) {
|
maven(MavenPublication) {
|
||||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
|
from components.java
|
||||||
artifact source: sourcesJar, classifier: "sources"
|
if (usesShadowedDependencies.toBoolean()) {
|
||||||
|
artifact source: shadowJar, classifier: ""
|
||||||
|
}
|
||||||
|
if (!project.hasProperty("noPublishedSources") || !noPublishedSources) {
|
||||||
|
artifact source: sourcesJar, classifier: "sources"
|
||||||
|
}
|
||||||
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
|
||||||
if (apiPackage) {
|
if (apiPackage) {
|
||||||
artifact source: apiJar, classifier: "api"
|
artifact source: apiJar, classifier: "api"
|
||||||
@@ -707,6 +727,12 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(PublishToMavenRepository) { task ->
|
||||||
|
dependsOn("build")
|
||||||
|
}
|
||||||
|
|
||||||
|
publishToMavenLocal.dependsOn("build")
|
||||||
|
|
||||||
if (project.changelog == "") {
|
if (project.changelog == "") {
|
||||||
File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
|
File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
|
||||||
if (changelogFile.exists()) {
|
if (changelogFile.exists()) {
|
||||||
@@ -729,7 +755,7 @@ if (curseForgeProjectId != "" && System.getenv("CURSEFORGE_TOKEN") != null) {
|
|||||||
addGameVersion project.minecraft.version
|
addGameVersion project.minecraft.version
|
||||||
addGameVersion "Forge"
|
addGameVersion "Forge"
|
||||||
mainArtifact(jar) {
|
mainArtifact(jar) {
|
||||||
displayName = "$modName version: $modVersion"
|
displayName = "$modName $modVersion"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
options {
|
options {
|
||||||
@@ -1043,7 +1069,7 @@ def deobf(String sourceURL, String rawFileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
download.run {
|
download.run {
|
||||||
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
|
src "https://github.com/FalsePattern/ExampleMod1.7.10/raw/main/blobs/BON2-2.5.1.jar"
|
||||||
dest bon2File
|
dest bon2File
|
||||||
quiet true
|
quiet true
|
||||||
overwrite false
|
overwrite false
|
||||||
@@ -1057,7 +1083,7 @@ def deobf(String sourceURL, String rawFileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
commandLine Paths.get(System.getProperty("java.home"), "bin", "java").toAbsolutePath().toString(), '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
|
||||||
workingDir bon2Dir
|
workingDir bon2Dir
|
||||||
standardOutput = new FileOutputStream("${deobfFile}.log")
|
standardOutput = new FileOutputStream("${deobfFile}.log")
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-5
@@ -16,12 +16,14 @@ def deobfCurse(curseDep) {
|
|||||||
dependencies {
|
dependencies {
|
||||||
////////////////Our dependencies////////////////
|
////////////////Our dependencies////////////////
|
||||||
|
|
||||||
compileOnly("org.projectlombok:lombok:1.18.24") {
|
compileOnly("org.projectlombok:lombok:1.18.28") {
|
||||||
transitive = false
|
transitive = false
|
||||||
}
|
}
|
||||||
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
annotationProcessor("org.projectlombok:lombok:1.18.28")
|
||||||
|
|
||||||
compile("com.falsepattern:falsepatternlib-mc1.7.10:0.10.13:dev")
|
implementation("com.falsepattern:falsepatternlib-mc1.7.10:0.12.1:dev")
|
||||||
|
|
||||||
|
implementation("com.falsepattern:chunkapi-mc1.7.10:0.3.2:dev")
|
||||||
|
|
||||||
////////////////Patched mods////////////////
|
////////////////Patched mods////////////////
|
||||||
|
|
||||||
@@ -68,8 +70,11 @@ dependencies {
|
|||||||
//Dark World 0.2
|
//Dark World 0.2
|
||||||
compileOnly(deobfCurse("darkworld-225075:2225172"))
|
compileOnly(deobfCurse("darkworld-225075:2225172"))
|
||||||
|
|
||||||
//DragonAPI V31b
|
//DimDoors 2.2.5-test9
|
||||||
compileOnly(deobfCurse("dragonapi-235591:3574508"))
|
compileOnly(deobf("https://github.com/CannibalVox/DimDoors/releases/download/2.2.5-test9/DimensionalDoors-2.2.5-test9.jar"))
|
||||||
|
|
||||||
|
//DragonAPI V32a
|
||||||
|
compileOnly(deobfCurse("dragonapi-235591:4611379"))
|
||||||
|
|
||||||
//Dynamic Surroundings 1.0.6.4
|
//Dynamic Surroundings 1.0.6.4
|
||||||
compileOnly(deobfCurse("dynamicsurrounding-238891:2642381"))
|
compileOnly(deobfCurse("dynamicsurrounding-238891:2642381"))
|
||||||
@@ -105,6 +110,9 @@ dependencies {
|
|||||||
//Immersive Cavegen 1.2g
|
//Immersive Cavegen 1.2g
|
||||||
compileOnly(deobfCurse("immersivecavegen-521557:3649411"))
|
compileOnly(deobfCurse("immersivecavegen-521557:3649411"))
|
||||||
|
|
||||||
|
//Industrial Revolution by Redstone Rebooted 1.1.1
|
||||||
|
compileOnly(deobfCurse("industrialrevolutionbyredstonerebooted-241812:2538035"))
|
||||||
|
|
||||||
//LOTR Mod 36.14
|
//LOTR Mod 36.14
|
||||||
compileOnly(deobfCurse("lotrmod-423748:3646430"))
|
compileOnly(deobfCurse("lotrmod-423748:3646430"))
|
||||||
|
|
||||||
@@ -126,6 +134,9 @@ dependencies {
|
|||||||
//Realistic Terrain Generation 1.1.1.7
|
//Realistic Terrain Generation 1.1.1.7
|
||||||
compileOnly(deobfCurse("rtg-237989:2521557"))
|
compileOnly(deobfCurse("rtg-237989:2521557"))
|
||||||
|
|
||||||
|
//Restructured 1.0.4.2
|
||||||
|
compileOnly(deobfCurse("restructured-230570:2276784"))
|
||||||
|
|
||||||
//Thaumcraft 4.2.3.5
|
//Thaumcraft 4.2.3.5
|
||||||
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
compileOnly(deobfCurse("thaumcraft-223628:2227552"))
|
||||||
|
|
||||||
|
|||||||
+2
-3
@@ -72,7 +72,7 @@ modrinthProjectId = qGHY4QGo
|
|||||||
# type can be one of [project, version],
|
# type can be one of [project, version],
|
||||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||||
# Example: required-project:fplib;optional-project:spongemixin1710;incompatible-project:gregtech
|
# Example: required-project:fplib;optional-project:spongemixin1710;incompatible-project:gregtech
|
||||||
modrinthDependencies = required-project:fplib;optional-project:spongemixin1710
|
modrinthDependencies = required-project:fplib;required-project:chunkapi
|
||||||
|
|
||||||
#endregion modrinth
|
#endregion modrinth
|
||||||
|
|
||||||
@@ -90,8 +90,7 @@ curseForgeProjectId = 665730
|
|||||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||||
# and the name is the CurseForge project id of the other mod.
|
# and the name is the CurseForge project id of the other mod.
|
||||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||||
# TODO add fplib once verified.
|
curseForgeRelations = requiredDependency:fplib;requiredDependency:chunkapi
|
||||||
curseForgeRelations = optionalDependency:spongemixins;optionalDependency:mixinbooterlegacy
|
|
||||||
|
|
||||||
#endregion curseforge
|
#endregion curseforge
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ChunkDataRegistry;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import com.falsepattern.endlessids.managers.BiomeManager;
|
||||||
|
import com.falsepattern.endlessids.managers.BlockIDManager;
|
||||||
|
import com.falsepattern.endlessids.managers.BlockMetaManager;
|
||||||
import com.falsepattern.endlessids.patching.CommonManager;
|
import com.falsepattern.endlessids.patching.CommonManager;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -15,7 +20,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
|||||||
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.10.13,);required-after:gasstation@[0.5.0,);after:antiidconflict")
|
dependencies = "required-after:chunkapi@[0.3.2,);required-after:falsepatternlib@[0.12.1,);required-after:gasstation@[0.5.0,);after:antiidconflict")
|
||||||
public class EndlessIDs {
|
public class EndlessIDs {
|
||||||
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
|
||||||
public static final byte[] FAKE_BIOME_ARRAY_PLACEHOLDER = new byte[256];
|
public static final byte[] FAKE_BIOME_ARRAY_PLACEHOLDER = new byte[256];
|
||||||
@@ -33,16 +38,59 @@ public class EndlessIDs {
|
|||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent e) {
|
public void preInit(FMLPreInitializationEvent e) {
|
||||||
|
LOG.info("---------------------------------------------------------");
|
||||||
|
LOG.info("Current EndlessIDs configuration:");
|
||||||
|
logConfig(" Biome Extension", GeneralConfig.extendBiome);
|
||||||
|
logConfig(" Block/Item Extension", GeneralConfig.extendBlockItem);
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
logConfig(" Extra Item Bits", GeneralConfig.extraItemIDBits);
|
||||||
|
logConfig(" Extra Block Bits", GeneralConfig.extraBlockIDBits);
|
||||||
|
}
|
||||||
|
logConfig(" DataWatcher Extension", GeneralConfig.extendDataWatcher);
|
||||||
|
logConfig(" Enchantment Extension", GeneralConfig.extendEnchantment);
|
||||||
|
logConfig(" Potion Extension", GeneralConfig.extendPotion);
|
||||||
|
logConfig(" Redstone Extension", GeneralConfig.extendRedstone);
|
||||||
|
if (GeneralConfig.extendRedstone) {
|
||||||
|
LOG.warn(" (Redstone extension is an experimental and dangerous feature, and should NEVER be used in worlds that you worry about getting corrupted!)");
|
||||||
|
logConfig(" Max redstone level", GeneralConfig.maxRedstone);
|
||||||
|
}
|
||||||
|
logConfig(" Registry performance tweak", GeneralConfig.enableRegistryPerformanceTweak);
|
||||||
|
if (GeneralConfig.enableRegistryPerformanceTweak) {
|
||||||
|
LOG.warn(" (This tweak has not gone through proper testing yet, so it might corrupt worlds. USE BACKUPS!)");
|
||||||
|
}
|
||||||
|
LOG.info("---------------------------------------------------------");
|
||||||
patchManager.preInit();
|
patchManager.preInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void logConfig(String name, boolean value) {
|
||||||
|
LOG.info(name + (value ? ": ENABLED" : ": disabled"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void logConfig(String name, int value) {
|
||||||
|
LOG.info(name + ": " + value);
|
||||||
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void init(FMLInitializationEvent e) {
|
public void init(FMLInitializationEvent e) {
|
||||||
patchManager.init();
|
patchManager.init();
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
ChunkDataRegistry.registerDataManager(new BiomeManager());
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
ChunkDataRegistry.registerDataManager(new BlockIDManager());
|
||||||
|
ChunkDataRegistry.registerDataManager(new BlockMetaManager());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mod.EventHandler
|
@Mod.EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent e) {
|
public void postInit(FMLPostInitializationEvent e) {
|
||||||
patchManager.postInit();
|
patchManager.postInit();
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
ChunkDataRegistry.disableDataManager("minecraft", "biome");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
ChunkDataRegistry.disableDataManager("minecraft", "blockid");
|
||||||
|
ChunkDataRegistry.disableDataManager("minecraft", "metadata");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,137 +2,10 @@ package com.falsepattern.endlessids;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
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 lombok.val;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.nio.ShortBuffer;
|
|
||||||
|
|
||||||
public class Hooks {
|
public class Hooks {
|
||||||
|
|
||||||
public static byte[] getBlockData(final IExtendedBlockStorageMixin ebs) {
|
|
||||||
val lsb = ebs.getLSB();
|
|
||||||
val msb = ebs.getMSB();
|
|
||||||
final byte[] ret = new byte[lsb.length * 3];
|
|
||||||
ByteBuffer.wrap(ret).asShortBuffer().put(lsb);
|
|
||||||
System.arraycopy(msb, 0, ret, lsb.length * 2, lsb.length);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setBlockData(final IExtendedBlockStorageMixin ebs, final byte[] data, final int offset) {
|
|
||||||
val lsb = ebs.getLSB();
|
|
||||||
val msb = ebs.getMSB();
|
|
||||||
val lsbBytes = lsb.length * 2;
|
|
||||||
ShortBuffer.wrap(ebs.getLSB()).put(ByteBuffer.wrap(data, offset, lsbBytes).asShortBuffer());
|
|
||||||
System.arraycopy(data, offset + lsbBytes, msb, 0, msb.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeChunkToNbt(final NBTTagCompound nbt, final IExtendedBlockStorageMixin ebs) {
|
|
||||||
val ebsLSB = ebs.getLSB();
|
|
||||||
val ebsMSB = ebs.getMSB();
|
|
||||||
|
|
||||||
val byte1Data = new byte[ebsLSB.length];
|
|
||||||
byte[] byte2BottomNibbleData = null;
|
|
||||||
byte[] byte2TopNibbleData = null;
|
|
||||||
byte[] byte3Data = null;
|
|
||||||
for (int i = 0; i < ebsLSB.length; ++i) {
|
|
||||||
if (ebsMSB[i] != 0) {
|
|
||||||
if (byte3Data == null) {
|
|
||||||
byte3Data = new byte[ebsLSB.length];
|
|
||||||
}
|
|
||||||
byte3Data[i] = ebsMSB[i];
|
|
||||||
}
|
|
||||||
val idLSB = (ebsLSB[i] & 0xFFFF);
|
|
||||||
byte1Data[i] = (byte) (idLSB & 0xFF);
|
|
||||||
|
|
||||||
if (idLSB <= 0xFF) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
val nibbleIndex = i >> 1;
|
|
||||||
val nibbleShift = (i & 1) * 4;
|
|
||||||
if (byte2BottomNibbleData == null) {
|
|
||||||
byte2BottomNibbleData = new byte[ebsLSB.length / 2];
|
|
||||||
}
|
|
||||||
byte2BottomNibbleData[nibbleIndex] |= ((idLSB >>> 8) & 0xF) << nibbleShift;
|
|
||||||
|
|
||||||
if (idLSB <= 0xFFF) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (byte2TopNibbleData == null) {
|
|
||||||
byte2TopNibbleData = new byte[ebsLSB.length / 2];
|
|
||||||
}
|
|
||||||
byte2TopNibbleData[nibbleIndex] |= ((idLSB >>> 12) & 0xF) << nibbleShift;
|
|
||||||
|
|
||||||
}
|
|
||||||
nbt.setByteArray("Blocks", byte1Data);
|
|
||||||
if (byte2BottomNibbleData != null) {
|
|
||||||
nbt.setByteArray("Add", byte2BottomNibbleData);
|
|
||||||
}
|
|
||||||
if (byte2TopNibbleData != null) {
|
|
||||||
nbt.setByteArray("BlocksB2Hi", byte2TopNibbleData);
|
|
||||||
}
|
|
||||||
if (byte3Data != null) {
|
|
||||||
nbt.setByteArray("BlocksB3", byte3Data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readChunkFromNbt(final IExtendedBlockStorageMixin ebs, final NBTTagCompound nbt) {
|
|
||||||
assert nbt.hasKey("Blocks");
|
|
||||||
val byte1Data = nbt.getByteArray("Blocks");
|
|
||||||
val byte2BottomNibbleData = nbt.hasKey("Add") ? nbt.getByteArray("Add") : null;
|
|
||||||
val byte2TopNibbleData = nbt.hasKey("BlocksB2Hi") ? nbt.getByteArray("BlocksB2Hi") : null;
|
|
||||||
val byte3Data = nbt.hasKey("BlocksB3") ? nbt.getByteArray("BlocksB3") : null;
|
|
||||||
|
|
||||||
val lsb = ebs.getLSB();
|
|
||||||
val msb = ebs.getMSB();
|
|
||||||
for (int i = 0; i < lsb.length; i++) {
|
|
||||||
if (byte3Data != null) {
|
|
||||||
msb[i] = byte3Data[i];
|
|
||||||
}
|
|
||||||
int nibbleShift = (i & 1) * 4;
|
|
||||||
int id = byte1Data[i] & 0xFF;
|
|
||||||
if (byte2BottomNibbleData != null) {
|
|
||||||
id |= ((byte2BottomNibbleData[i >> 1] >> nibbleShift) & 0xF) << 8;
|
|
||||||
}
|
|
||||||
if (byte2TopNibbleData != null) {
|
|
||||||
id |= ((byte2TopNibbleData[i >> 1] >> nibbleShift) & 0xF) << 12;
|
|
||||||
}
|
|
||||||
lsb[i] = (short) id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeInvalidBlocksHook(final IExtendedBlockStorageMixin ebs) {
|
|
||||||
val blkIdsLSB = ebs.getLSB();
|
|
||||||
val blkIdsMSB = ebs.getMSB();
|
|
||||||
int cntNonEmpty = 0;
|
|
||||||
int cntTicking = 0;
|
|
||||||
for (int off = 0; off < blkIdsLSB.length; ++off) {
|
|
||||||
final int id =
|
|
||||||
((blkIdsLSB[off] & 0xFFFF) | ((blkIdsMSB[off] & 0xFF) << 16)) & ExtendedConstants.blockIDMask;
|
|
||||||
if (id > 0) {
|
|
||||||
final Block block = (Block) Block.blockRegistry.getObjectById(id);
|
|
||||||
if (block == null) {
|
|
||||||
if (GeneralConfig.removeInvalidBlocks) {
|
|
||||||
blkIdsLSB[off] = 0;
|
|
||||||
}
|
|
||||||
} else if (block != Blocks.air) {
|
|
||||||
++cntNonEmpty;
|
|
||||||
if (block.getTickRandomly()) {
|
|
||||||
++cntTicking;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ebs.setBlockRefCount(cntNonEmpty);
|
|
||||||
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 (GeneralConfig.catchUnregisteredBlocks && id == -1) {
|
if (GeneralConfig.catchUnregisteredBlocks && id == -1) {
|
||||||
@@ -151,8 +24,8 @@ public class Hooks {
|
|||||||
public static void shortToByteArray(short[] shortArray, int shortOffset, byte[] byteArray, int byteOffset, int shortCount) {
|
public static void shortToByteArray(short[] shortArray, int shortOffset, byte[] byteArray, int byteOffset, int shortCount) {
|
||||||
for (int i = 0; i < shortCount; i++) {
|
for (int i = 0; i < shortCount; i++) {
|
||||||
short s = shortArray[shortOffset + i];
|
short s = shortArray[shortOffset + i];
|
||||||
byteArray[byteOffset + i * 2] = (byte)(s & 255);
|
byteArray[byteOffset + i * 2] = (byte) (s & 255);
|
||||||
byteArray[byteOffset + i * 2 + 1] = (byte)((s >>> 8) & 255);
|
byteArray[byteOffset + i * 2 + 1] = (byte) ((s >>> 8) & 255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,47 +56,9 @@ public class Hooks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void oldBiomeByteToNewShortArray(byte[] byteArray, short[] shortArray) {
|
public static void scatter(byte[] byteArray, short[] shortArray) {
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < byteArray.length; i++) {
|
||||||
shortArray[i] = (short) (byteArray[i] & 0xff);
|
shortArray[i] = (short) (byteArray[i] & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int readBiomeArrayFromPacket(Chunk chunk, byte[] array, int offset) {
|
|
||||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
|
||||||
byteToShortArray(array, offset, biomeArray, 0, biomeArray.length * 2);
|
|
||||||
return biomeArray.length * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int writeBiomeArrayToPacket(Chunk chunk, byte[] array, int offset) {
|
|
||||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
|
||||||
shortToByteArray(biomeArray, 0, array, offset, biomeArray.length);
|
|
||||||
return biomeArray.length * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeChunkBiomeArrayToNbt(Chunk chunk, NBTTagCompound nbt) {
|
|
||||||
byte[] byteArray = shortToByteArray(((IChunkMixin) chunk).getBiomeShortArray());
|
|
||||||
nbt.setByteArray("Biomes16v2", byteArray);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readChunkBiomeArrayFromNbt(Chunk chunk, NBTTagCompound nbt) {
|
|
||||||
short[] data = ((IChunkMixin)chunk).getBiomeShortArray();
|
|
||||||
boolean put = false;
|
|
||||||
if (data == null) {
|
|
||||||
data = new short[16 * 16];
|
|
||||||
put = true;
|
|
||||||
}
|
|
||||||
if (nbt.hasKey("Biomes16v2", 7)) {
|
|
||||||
byteToShortArray(nbt.getByteArray("Biomes16v2"), 0, data, 0, data.length * 2);
|
|
||||||
} else if (nbt.hasKey("Biomes16", 7)) {
|
|
||||||
byteToShortArrayLegacy(nbt.getByteArray("Biomes16"), data);
|
|
||||||
} else if (nbt.hasKey("Biomes", 7)) {
|
|
||||||
oldBiomeByteToNewShortArray(nbt.getByteArray("Biomes"), data);
|
|
||||||
} else {
|
|
||||||
put = false;
|
|
||||||
}
|
|
||||||
if (put) {
|
|
||||||
((IChunkMixin) chunk).setBiomeShortArray(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.falsepattern.endlessids;
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
import com.falsepattern.endlessids.asm.IETransformer;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||||
|
import cpw.mods.fml.relauncher.FMLInjectionData;
|
||||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -17,7 +19,7 @@ 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", "com.falsepattern.endlessids.config.GeneralConfig"})
|
||||||
@DependsOn("falsepatternlib")
|
@DependsOn("falsepatternlib")
|
||||||
public class IEPlugin implements IFMLLoadingPlugin {
|
public class IEPlugin implements IFMLLoadingPlugin {
|
||||||
|
|
||||||
@@ -42,6 +44,21 @@ public class IEPlugin implements IFMLLoadingPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getModContainerClass() {
|
public String getModContainerClass() {
|
||||||
|
if (GeneralConfig.extendBiome) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.BiomeContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendBlockItem) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.BlockItemContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendDataWatcher) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.DataWatcherContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendEnchantment) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.EnchantmentContainer");
|
||||||
|
}
|
||||||
|
if (GeneralConfig.extendPotion) {
|
||||||
|
FMLInjectionData.containers.add(Tags.GROUPNAME + ".containers.PotionContainer");
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.falsepattern.endlessids;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
|
import sun.misc.Unsafe;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ShortBuffer;
|
||||||
|
|
||||||
|
public class Unsafer {
|
||||||
|
public static final Unsafe UNSAFE;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Field unsafeField = null;
|
||||||
|
Unsafe unsafe = null;
|
||||||
|
for (val field : Unsafe.class.getDeclaredFields()) {
|
||||||
|
if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) &&
|
||||||
|
field.getType().equals(Unsafe.class)) {
|
||||||
|
unsafeField = field;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (unsafeField != null) {
|
||||||
|
unsafeField.setAccessible(true);
|
||||||
|
try {
|
||||||
|
unsafe = (Unsafe) unsafeField.get(null);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (unsafe == null) {
|
||||||
|
UNSAFE = null;
|
||||||
|
new IllegalStateException("Could not retrieve Unsafe! Falling back to bytebuffers!").printStackTrace();
|
||||||
|
} else {
|
||||||
|
UNSAFE = unsafe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void arraycopy(short[] source, int sourceOffset, byte[] target, int targetOffset, int shorts) {
|
||||||
|
if (UNSAFE != null) {
|
||||||
|
val sourceOffsetBytes = sourceOffset * 2;
|
||||||
|
val arrayOffsetSource = UNSAFE.arrayBaseOffset(source.getClass());
|
||||||
|
val arrayOffsetTarget = UNSAFE.arrayBaseOffset(target.getClass());
|
||||||
|
UNSAFE.copyMemory(source, arrayOffsetSource + sourceOffsetBytes, target, arrayOffsetTarget + targetOffset,
|
||||||
|
(long) shorts << 1);
|
||||||
|
} else {
|
||||||
|
ByteBuffer.wrap(target, targetOffset, target.length - targetOffset)
|
||||||
|
.asShortBuffer()
|
||||||
|
.put(source, sourceOffset, shorts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void arraycopy(byte[] source, int sourceOffset, short[] target, int targetOffset, int shorts) {
|
||||||
|
if (UNSAFE != null) {
|
||||||
|
val targetOffsetBytes = targetOffset * 2;
|
||||||
|
val arrayOffsetSource = UNSAFE.arrayBaseOffset(source.getClass());
|
||||||
|
val arrayOffsetTarget = UNSAFE.arrayBaseOffset(target.getClass());
|
||||||
|
UNSAFE.copyMemory(source, arrayOffsetSource + sourceOffset, target, arrayOffsetTarget + targetOffsetBytes,
|
||||||
|
(long) shorts << 1);
|
||||||
|
} else {
|
||||||
|
ShortBuffer.wrap(target, targetOffset, target.length - targetOffset)
|
||||||
|
.put(ByteBuffer.wrap(source, sourceOffset, shorts * 2).asShortBuffer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
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,42 +1,60 @@
|
|||||||
package com.falsepattern.endlessids.asm;
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.transformer.ChunkProviderSuperPatcher;
|
import com.falsepattern.endlessids.asm.transformer.ChunkProviderSuperPatcher;
|
||||||
import com.falsepattern.endlessids.asm.transformer.DragonAPIModList;
|
|
||||||
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
|
||||||
|
import com.falsepattern.endlessids.asm.transformer.GameDataAccelerator;
|
||||||
import com.falsepattern.endlessids.asm.transformer.SpaceCoreModInfoGenerator;
|
import com.falsepattern.endlessids.asm.transformer.SpaceCoreModInfoGenerator;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public enum ClassEdit {
|
public enum ClassEdit {
|
||||||
ChunkProviderSuperPatcher(new ChunkProviderSuperPatcher()),
|
ChunkProviderSuperPatcher(new ChunkProviderSuperPatcher(), () -> GeneralConfig.extendBiome),
|
||||||
DragonAPIModList(new DragonAPIModList(), "Reika.DragonAPI.ModList"),
|
|
||||||
FmlRegistry(new FmlRegistry(),
|
FmlRegistry(new FmlRegistry(),
|
||||||
|
() -> GeneralConfig.extendBlockItem,
|
||||||
"cpw.mods.fml.common.registry.GameData",
|
"cpw.mods.fml.common.registry.GameData",
|
||||||
"cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry"),
|
"cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry"),
|
||||||
SpaceCoreModInfoGenerator(new SpaceCoreModInfoGenerator(), "com.spacechase0.minecraft.spacecore.mcp.ModInfoGenerator");
|
SpaceCoreModInfoGenerator(new SpaceCoreModInfoGenerator(), () -> true,
|
||||||
|
"com.spacechase0.minecraft.spacecore.mcp.ModInfoGenerator"),
|
||||||
|
GameDataAccelerator(new GameDataAccelerator(), () -> GeneralConfig.enableRegistryPerformanceTweak, "cpw.mods.fml.common.registry.GameData"),
|
||||||
|
;
|
||||||
|
|
||||||
private static final Map<String, ClassEdit> editMap;
|
private static final Map<String, List<ClassEdit>> editMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
editMap = new HashMap<>();
|
editMap = new HashMap<>();
|
||||||
for (final ClassEdit edit : values()) {
|
for (final ClassEdit edit : values()) {
|
||||||
for (final String name : edit.classNames) {
|
for (final String name : edit.classNames) {
|
||||||
ClassEdit.editMap.put(name, edit);
|
ClassEdit.editMap.computeIfAbsent(name, (ignored) -> new ArrayList<>()).add(edit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final IClassNodeTransformer transformer;
|
private final IClassNodeTransformer transformer;
|
||||||
|
private final BooleanSupplier cond;
|
||||||
private final String[] classNames;
|
private final String[] classNames;
|
||||||
|
|
||||||
ClassEdit(final IClassNodeTransformer transformer, final String... classNames) {
|
ClassEdit(final IClassNodeTransformer transformer, BooleanSupplier cond, final String... classNames) {
|
||||||
this.transformer = transformer;
|
this.transformer = transformer;
|
||||||
|
this.cond = cond;
|
||||||
this.classNames = classNames;
|
this.classNames = classNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClassEdit get(final String className) {
|
public static List<ClassEdit> get(final String className) {
|
||||||
return ClassEdit.editMap.get(className);
|
val edit = ClassEdit.editMap.get(className);
|
||||||
|
if (edit == null) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return edit.stream()
|
||||||
|
.filter(r -> r.cond.getAsBoolean())
|
||||||
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.falsepattern.endlessids.asm;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.asm.stubpackage.cpw.mods.fml.common.registry.GameData;
|
||||||
|
import com.falsepattern.endlessids.util.WeakIdentityHashMap;
|
||||||
|
import lombok.var;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
|
public class GameDataHooks {
|
||||||
|
private static WeakIdentityHashMap<Block, WeakReference<ItemBlock>> forGameData(GameData gameData) {
|
||||||
|
if (gameData.endlessIDsItemBlockCache == null) {
|
||||||
|
gameData.endlessIDsItemBlockCache = new WeakIdentityHashMap<>();
|
||||||
|
}
|
||||||
|
return gameData.endlessIDsItemBlockCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void cacheItemBlock(ItemBlock itemBlock, GameData gameData) {
|
||||||
|
forGameData(gameData).put(itemBlock.field_150939_a, new WeakReference<>(itemBlock));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ItemBlock fetchCachedItemBlock(Block block, GameData gameData) {
|
||||||
|
var weakItem = forGameData(gameData).get(block);
|
||||||
|
if (weakItem != null) {
|
||||||
|
return weakItem.get();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Iterable<Item> fakeIterable() {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.falsepattern.endlessids.Tags;
|
|||||||
import com.falsepattern.endlessids.asm.transformer.ChunkProviderSuperPatcher;
|
import com.falsepattern.endlessids.asm.transformer.ChunkProviderSuperPatcher;
|
||||||
import com.falsepattern.endlessids.asm.transformer.DevFixer;
|
import com.falsepattern.endlessids.asm.transformer.DevFixer;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.objectweb.asm.ClassReader;
|
import org.objectweb.asm.ClassReader;
|
||||||
@@ -18,9 +19,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class IETransformer implements IClassTransformer {
|
public class IETransformer implements IClassTransformer {
|
||||||
public static final Logger logger;
|
public static final Logger logger;
|
||||||
public static boolean isObfuscated;
|
|
||||||
|
|
||||||
private static final List<String> blacklist = new ArrayList<>();
|
private static final List<String> blacklist = new ArrayList<>();
|
||||||
|
public static boolean isObfuscated;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
logger = LogManager.getLogger(Tags.MODNAME + " ASM");
|
logger = LogManager.getLogger(Tags.MODNAME + " ASM");
|
||||||
@@ -38,8 +38,7 @@ public class IETransformer implements IClassTransformer {
|
|||||||
if (blacklist.contains(transformedName)) {
|
if (blacklist.contains(transformedName)) {
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
ClassEdit[] edits = new ClassEdit[2];
|
var edits = new ArrayList<ClassEdit>(ClassEdit.get(transformedName));
|
||||||
edits[0] = ClassEdit.get(transformedName);
|
|
||||||
ClassNode cn = new ClassNode(Opcodes.ASM5);
|
ClassNode cn = new ClassNode(Opcodes.ASM5);
|
||||||
{
|
{
|
||||||
val reader = new ClassReader(bytes);
|
val reader = new ClassReader(bytes);
|
||||||
@@ -53,20 +52,15 @@ public class IETransformer implements IClassTransformer {
|
|||||||
val reader = new ClassReader(bytes);
|
val reader = new ClassReader(bytes);
|
||||||
reader.accept(cn, ClassReader.EXPAND_FRAMES);
|
reader.accept(cn, ClassReader.EXPAND_FRAMES);
|
||||||
}
|
}
|
||||||
if (edits[0] == null) {
|
edits.add(ClassEdit.ChunkProviderSuperPatcher);
|
||||||
edits[0] = ClassEdit.ChunkProviderSuperPatcher;
|
|
||||||
} else {
|
|
||||||
edits[1] = ClassEdit.ChunkProviderSuperPatcher;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (edits[0] == null) {
|
if (edits.size() == 0) {
|
||||||
return isObfuscated ? bytes : DevFixer.fixDev(bytes);
|
return isObfuscated ? bytes : DevFixer.fixDev(bytes);
|
||||||
}
|
}
|
||||||
if (!isObfuscated) {
|
if (!isObfuscated) {
|
||||||
DevFixer.transform(cn);
|
DevFixer.transform(cn);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < edits.length; i++) {
|
for (final ClassEdit edit : edits) {
|
||||||
val edit = edits[i];
|
|
||||||
if (edit == null) {
|
if (edit == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package com.falsepattern.endlessids.asm.stubpackage.cpw.mods.fml.common.registry;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.util.WeakIdentityHashMap;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
public class GameData {
|
||||||
|
public WeakIdentityHashMap<Block, WeakReference<ItemBlock>> endlessIDsItemBlockCache;
|
||||||
|
}
|
||||||
+120
-127
@@ -2,6 +2,7 @@ package com.falsepattern.endlessids.asm.transformer;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
import com.falsepattern.endlessids.asm.IETransformer;
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import lombok.var;
|
import lombok.var;
|
||||||
@@ -122,84 +123,6 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
public static final String[] CLASS_Chunk;
|
public static final String[] CLASS_Chunk;
|
||||||
public static final String[] FIELD_biomeID;
|
public static final String[] FIELD_biomeID;
|
||||||
public static final String[] METHOD_getBiomeArray;
|
public static final String[] METHOD_getBiomeArray;
|
||||||
|
|
||||||
static {
|
|
||||||
if (IETransformer.isObfuscated) {
|
|
||||||
CLASS_BiomeGenBase = new String[]{"ahu", "net/minecraft/world/biome/BiomeGenBase"};
|
|
||||||
CLASS_IChunkProvider = new String[]{"apu", "net/minecraft/world/chunk/IChunkProvider"};
|
|
||||||
CLASS_ChunkProviderGenerate = new String[]{"aqz", "net/minecraft/world/gen/ChunkProviderGenerate"};
|
|
||||||
CLASS_Chunk = new String[]{"apx", "net/minecraft/world/chunk/Chunk"};
|
|
||||||
FIELD_biomeID = new String[]{"ay", "field_76756_M"};
|
|
||||||
METHOD_getBiomeArray = new String[]{"m", "func_76605_m"};
|
|
||||||
} else {
|
|
||||||
CLASS_BiomeGenBase = new String[]{"net/minecraft/world/biome/BiomeGenBase"};
|
|
||||||
CLASS_IChunkProvider = new String[]{"net/minecraft/world/chunk/IChunkProvider"};
|
|
||||||
CLASS_ChunkProviderGenerate = new String[]{"net/minecraft/world/gen/ChunkProviderGenerate"};
|
|
||||||
CLASS_Chunk = new String[]{"net/minecraft/world/chunk/Chunk"};
|
|
||||||
FIELD_biomeID = new String[]{"biomeID"};
|
|
||||||
METHOD_getBiomeArray = new String[]{"getBiomeArray"};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shouldPatch(final ClassNode cn) {
|
|
||||||
for (MethodNode method : cn.methods) {
|
|
||||||
if (scanForBrokenCall(method)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean scanForBrokenCall(MethodNode method) {
|
|
||||||
val instructions = method.instructions;
|
|
||||||
val insnCount = instructions.size();
|
|
||||||
for (int i = 0; i < insnCount; i++) {
|
|
||||||
val insn = instructions.get(i);
|
|
||||||
if (insn.getOpcode() != Opcodes.INVOKEVIRTUAL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
val invoke = (MethodInsnNode) insn;
|
|
||||||
|
|
||||||
if (anyMatch(invoke.owner, CLASS_Chunk) &&
|
|
||||||
anyMatch(invoke.name, METHOD_getBiomeArray) &&
|
|
||||||
invoke.desc.equals("()[B")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean anyMatch(List<String> str, String[] candidates) {
|
|
||||||
for (val s: str) {
|
|
||||||
for (val candidate: candidates) {
|
|
||||||
if (s.equals(candidate)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean anyMatch(String str, String[] candidates) {
|
|
||||||
for (val candidate: candidates) {
|
|
||||||
if (str.equals(candidate)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean anyMatch(String str, String[] candidates, String prefix, String suffix) {
|
|
||||||
for (val candidate: candidates) {
|
|
||||||
if (str.equals(prefix + candidate + suffix)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface State<T extends AbstractInsnNode> extends BiFunction<T, Memory, State<AbstractInsnNode>> {}
|
|
||||||
|
|
||||||
private static State<AbstractInsnNode> STATE0 = null;
|
private static State<AbstractInsnNode> STATE0 = null;
|
||||||
private static State<AbstractInsnNode> STATE1 = null;
|
private static State<AbstractInsnNode> STATE1 = null;
|
||||||
private static State<AbstractInsnNode> STATE2 = null;
|
private static State<AbstractInsnNode> STATE2 = null;
|
||||||
@@ -224,6 +147,25 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
private static State<AbstractInsnNode> STATE16 = null;
|
private static State<AbstractInsnNode> STATE16 = null;
|
||||||
private static State<AbstractInsnNode> STATE17 = null;
|
private static State<AbstractInsnNode> STATE17 = null;
|
||||||
private static State<AbstractInsnNode> STATE_FINAL = null;
|
private static State<AbstractInsnNode> STATE_FINAL = null;
|
||||||
|
|
||||||
|
static {
|
||||||
|
if (IETransformer.isObfuscated) {
|
||||||
|
CLASS_BiomeGenBase = new String[]{"ahu", "net/minecraft/world/biome/BiomeGenBase"};
|
||||||
|
CLASS_IChunkProvider = new String[]{"apu", "net/minecraft/world/chunk/IChunkProvider"};
|
||||||
|
CLASS_ChunkProviderGenerate = new String[]{"aqz", "net/minecraft/world/gen/ChunkProviderGenerate"};
|
||||||
|
CLASS_Chunk = new String[]{"apx", "net/minecraft/world/chunk/Chunk"};
|
||||||
|
FIELD_biomeID = new String[]{"ay", "field_76756_M"};
|
||||||
|
METHOD_getBiomeArray = new String[]{"m", "func_76605_m"};
|
||||||
|
} else {
|
||||||
|
CLASS_BiomeGenBase = new String[]{"net/minecraft/world/biome/BiomeGenBase"};
|
||||||
|
CLASS_IChunkProvider = new String[]{"net/minecraft/world/chunk/IChunkProvider"};
|
||||||
|
CLASS_ChunkProviderGenerate = new String[]{"net/minecraft/world/gen/ChunkProviderGenerate"};
|
||||||
|
CLASS_Chunk = new String[]{"net/minecraft/world/chunk/Chunk"};
|
||||||
|
FIELD_biomeID = new String[]{"biomeID"};
|
||||||
|
METHOD_getBiomeArray = new String[]{"getBiomeArray"};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
STATE_FINAL = (insn, memory) -> STATE_FINAL;
|
STATE_FINAL = (insn, memory) -> STATE_FINAL;
|
||||||
|
|
||||||
@@ -272,7 +214,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
STATE6 = typeCheck(LabelNode.class, () -> STATE7);
|
STATE6 = typeCheck(LabelNode.class, () -> STATE7);
|
||||||
|
|
||||||
STATE7 = casting(FrameNode.class, (insn, memory) ->
|
STATE7 = casting(FrameNode.class, (insn, memory) ->
|
||||||
anyMatch((String)memory.locals.get(memory.chunkIndex), CLASS_Chunk) &&
|
anyMatch((String) memory.locals.get(memory.chunkIndex), CLASS_Chunk) &&
|
||||||
memory.locals.get(memory.biomeArrayIndex).equals("[B") &&
|
memory.locals.get(memory.biomeArrayIndex).equals("[B") &&
|
||||||
memory.locals.get(memory.iteratorIndex).equals(1)
|
memory.locals.get(memory.iteratorIndex).equals(1)
|
||||||
? STATE8 : STATE0);
|
? STATE8 : STATE0);
|
||||||
@@ -287,13 +229,9 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
&& insn.var == memory.biomeArrayIndex
|
&& insn.var == memory.biomeArrayIndex
|
||||||
? STATE10 : STATE0);
|
? STATE10 : STATE0);
|
||||||
|
|
||||||
STATE10 = casting(InsnNode.class, (insn) ->
|
STATE10 = casting(InsnNode.class, (insn) -> insn.getOpcode() == Opcodes.ARRAYLENGTH ? STATE11 : STATE0);
|
||||||
insn.getOpcode() == Opcodes.ARRAYLENGTH
|
|
||||||
? STATE11 : STATE0);
|
|
||||||
|
|
||||||
STATE11 = casting(JumpInsnNode.class, (insn) ->
|
STATE11 = casting(JumpInsnNode.class, (insn) -> insn.getOpcode() == Opcodes.IF_ICMPGE ? STATE12 : STATE0);
|
||||||
insn.getOpcode() == Opcodes.IF_ICMPGE
|
|
||||||
? STATE12 : STATE0);
|
|
||||||
|
|
||||||
STATE12 = typeCheck(LabelNode.class, () -> STATE13);
|
STATE12 = typeCheck(LabelNode.class, () -> STATE13);
|
||||||
|
|
||||||
@@ -303,8 +241,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
? STATE14 : STATE0);
|
? STATE14 : STATE0);
|
||||||
|
|
||||||
STATE14 = casting(VarInsnNode.class, (insn, memory) -> {
|
STATE14 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.ILOAD &&
|
if (insn.getOpcode() == Opcodes.ILOAD && insn.var == memory.iteratorIndex) {
|
||||||
insn.var == memory.iteratorIndex) {
|
|
||||||
if (insn.getNext() instanceof FieldInsnNode) {
|
if (insn.getNext() instanceof FieldInsnNode) {
|
||||||
return STATE14_C1;
|
return STATE14_C1;
|
||||||
} else {
|
} else {
|
||||||
@@ -316,7 +253,7 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
|
|
||||||
STATE14_ABD1 = casting(VarInsnNode.class, (insn, memory) -> {
|
STATE14_ABD1 = casting(VarInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.ALOAD) {
|
if (insn.getOpcode() == Opcodes.ALOAD) {
|
||||||
if (anyMatch((String)memory.locals.get(insn.var), CLASS_BiomeGenBase, "[L", ";")) {
|
if (anyMatch((String) memory.locals.get(insn.var), CLASS_BiomeGenBase, "[L", ";")) {
|
||||||
return STATE14_ABD1_BA2;
|
return STATE14_ABD1_BA2;
|
||||||
} else {
|
} else {
|
||||||
return STATE14_ABD1_BD1;
|
return STATE14_ABD1_BD1;
|
||||||
@@ -337,17 +274,12 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
});
|
});
|
||||||
|
|
||||||
STATE14_ABD1_BA2 = casting(VarInsnNode.class, (insn, memory) ->
|
STATE14_ABD1_BA2 = casting(VarInsnNode.class, (insn, memory) ->
|
||||||
insn.getOpcode() == Opcodes.ILOAD &&
|
insn.getOpcode() == Opcodes.ILOAD && insn.var == memory.iteratorIndex ? STATE14_ABD1_BA3 : STATE0);
|
||||||
insn.var == memory.iteratorIndex
|
|
||||||
? STATE14_ABD1_BA3 : STATE0);
|
|
||||||
|
|
||||||
STATE14_ABD1_BA3 = casting(InsnNode.class, (insn) ->
|
STATE14_ABD1_BA3 = casting(InsnNode.class, (insn) -> insn.getOpcode() == Opcodes.AALOAD ? STATE15 : STATE0);
|
||||||
insn.getOpcode() == Opcodes.AALOAD
|
|
||||||
? STATE15 : STATE0);
|
|
||||||
|
|
||||||
STATE14_C1 = casting(FieldInsnNode.class, (insn, memory) -> {
|
STATE14_C1 = casting(FieldInsnNode.class, (insn, memory) -> {
|
||||||
if (insn.getOpcode() == Opcodes.GETSTATIC &&
|
if (insn.getOpcode() == Opcodes.GETSTATIC && anyMatch(insn.desc, CLASS_BiomeGenBase, "L", ";")) {
|
||||||
anyMatch(insn.desc, CLASS_BiomeGenBase, "L", ";")) {
|
|
||||||
return STATE15;
|
return STATE15;
|
||||||
}
|
}
|
||||||
return STATE0;
|
return STATE0;
|
||||||
@@ -377,6 +309,65 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean shouldPatch(final ClassNode cn) {
|
||||||
|
if (!GeneralConfig.extendBiome) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (MethodNode method : cn.methods) {
|
||||||
|
if (scanForBrokenCall(method)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean scanForBrokenCall(MethodNode method) {
|
||||||
|
val instructions = method.instructions;
|
||||||
|
val insnCount = instructions.size();
|
||||||
|
for (int i = 0; i < insnCount; i++) {
|
||||||
|
val insn = instructions.get(i);
|
||||||
|
if (insn.getOpcode() != Opcodes.INVOKEVIRTUAL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val invoke = (MethodInsnNode) insn;
|
||||||
|
|
||||||
|
if (anyMatch(invoke.owner, CLASS_Chunk) && anyMatch(invoke.name, METHOD_getBiomeArray) &&
|
||||||
|
invoke.desc.equals("()[B")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean anyMatch(List<String> str, String[] candidates) {
|
||||||
|
for (val s : str) {
|
||||||
|
for (val candidate : candidates) {
|
||||||
|
if (s.equals(candidate)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean anyMatch(String str, String[] candidates) {
|
||||||
|
for (val candidate : candidates) {
|
||||||
|
if (str.equals(candidate)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean anyMatch(String str, String[] candidates, String prefix, String suffix) {
|
||||||
|
for (val candidate : candidates) {
|
||||||
|
if (str.equals(prefix + candidate + suffix)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static <T extends AbstractInsnNode> State<AbstractInsnNode> typeCheck(Class<T> clazz, Supplier<State<AbstractInsnNode>> okState) {
|
private static <T extends AbstractInsnNode> State<AbstractInsnNode> typeCheck(Class<T> clazz, Supplier<State<AbstractInsnNode>> okState) {
|
||||||
return casting(clazz, (insn, memory) -> okState.get());
|
return casting(clazz, (insn, memory) -> okState.get());
|
||||||
}
|
}
|
||||||
@@ -397,33 +388,6 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void transform(final ClassNode cn, final boolean obfuscated) {
|
|
||||||
boolean patched = false;
|
|
||||||
for (val method: cn.methods) {
|
|
||||||
val memory = findTheTarget(method);
|
|
||||||
if (memory != null) {
|
|
||||||
patched = true;
|
|
||||||
IETransformer.logger.debug("[ChunkProvider patcher]: Match found in method " + method.name);
|
|
||||||
val insnList = method.instructions;
|
|
||||||
for (val node: method.localVariables) {
|
|
||||||
if (node.desc.equals("[B") && node.index == memory.biomeArrayIndex) {
|
|
||||||
node.desc = "[S";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val getBiomeArray = (MethodInsnNode) insnList.get(memory.getBiomeArrayInsn);
|
|
||||||
insnList.set(getBiomeArray, new MethodInsnNode(Opcodes.INVOKEVIRTUAL, getBiomeArray.owner, "getBiomeShortArray", "()[S", false));
|
|
||||||
insnList.set(insnList.get(memory.castInsn), new InsnNode(Opcodes.I2S));
|
|
||||||
insnList.set(insnList.get(memory.arrayStoreInsn), new InsnNode(Opcodes.SASTORE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!patched) {
|
|
||||||
IETransformer.logger.debug("[ChunkProvider patcher]: No matches found in class! This is not explicitly " +
|
|
||||||
"an error, because the patch might be applied by a mixin instead!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static Memory findTheTarget(MethodNode method) {
|
private static Memory findTheTarget(MethodNode method) {
|
||||||
val insnList = method.instructions;
|
val insnList = method.instructions;
|
||||||
var currentState = STATE0;
|
var currentState = STATE0;
|
||||||
@@ -449,20 +413,49 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void transform(final ClassNode cn, final boolean obfuscated) {
|
||||||
|
boolean patched = false;
|
||||||
|
for (val method : cn.methods) {
|
||||||
|
val memory = findTheTarget(method);
|
||||||
|
if (memory != null) {
|
||||||
|
patched = true;
|
||||||
|
IETransformer.logger.debug("[ChunkProvider patcher]: Match found in method " + method.name);
|
||||||
|
val insnList = method.instructions;
|
||||||
|
for (val node : method.localVariables) {
|
||||||
|
if (node.desc.equals("[B") && node.index == memory.biomeArrayIndex) {
|
||||||
|
node.desc = "[S";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val getBiomeArray = (MethodInsnNode) insnList.get(memory.getBiomeArrayInsn);
|
||||||
|
insnList.set(getBiomeArray,
|
||||||
|
new MethodInsnNode(Opcodes.INVOKEVIRTUAL, getBiomeArray.owner, "getBiomeShortArray",
|
||||||
|
"()[S", false));
|
||||||
|
insnList.set(insnList.get(memory.castInsn), new InsnNode(Opcodes.I2S));
|
||||||
|
insnList.set(insnList.get(memory.arrayStoreInsn), new InsnNode(Opcodes.SASTORE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!patched) {
|
||||||
|
IETransformer.logger.debug("[ChunkProvider patcher]: No matches found in class! This is not explicitly " +
|
||||||
|
"an error, because the patch might be applied by a mixin instead!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public interface State<T extends AbstractInsnNode> extends BiFunction<T, Memory, State<AbstractInsnNode>> {
|
||||||
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
private static class Memory {
|
private static class Memory {
|
||||||
|
|
||||||
|
final List<Object> locals = new ArrayList<>();
|
||||||
int currentInsn;
|
int currentInsn;
|
||||||
|
|
||||||
int startingInsn;
|
int startingInsn;
|
||||||
int getBiomeArrayInsn;
|
int getBiomeArrayInsn;
|
||||||
int castInsn;
|
int castInsn;
|
||||||
int arrayStoreInsn;
|
int arrayStoreInsn;
|
||||||
|
|
||||||
int chunkIndex;
|
int chunkIndex;
|
||||||
int biomeArrayIndex;
|
int biomeArrayIndex;
|
||||||
int iteratorIndex;
|
int iteratorIndex;
|
||||||
|
|
||||||
final List<Object> locals = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.falsepattern.endlessids.asm.transformer;
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.asm.ClassEdit;
|
|
||||||
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
|
||||||
import com.falsepattern.endlessids.asm.IETransformer;
|
import com.falsepattern.endlessids.asm.IETransformer;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -21,6 +19,7 @@ import java.io.IOException;
|
|||||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
public final class DevFixer {
|
public final class DevFixer {
|
||||||
private static final ClassNode blocks;
|
private static final ClassNode blocks;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
if (IETransformer.isObfuscated) {
|
if (IETransformer.isObfuscated) {
|
||||||
blocks = null;
|
blocks = null;
|
||||||
@@ -62,7 +61,7 @@ public final class DevFixer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void biomeTweakerCompat(final ClassNode cn) {
|
private static void biomeTweakerCompat(final ClassNode cn) {
|
||||||
for (val field: cn.fields) {
|
for (val field : cn.fields) {
|
||||||
if (field.name.startsWith("spawnable")) {
|
if (field.name.startsWith("spawnable")) {
|
||||||
field.access &= ~Opcodes.ACC_PROTECTED;
|
field.access &= ~Opcodes.ACC_PROTECTED;
|
||||||
field.access |= Opcodes.ACC_PUBLIC;
|
field.access |= Opcodes.ACC_PUBLIC;
|
||||||
@@ -71,18 +70,16 @@ public final class DevFixer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void remapBlocks(final ClassNode cn) {
|
private static void remapBlocks(final ClassNode cn) {
|
||||||
for (val method: cn.methods) {
|
for (val method : cn.methods) {
|
||||||
val instructions = method.instructions;
|
val instructions = method.instructions;
|
||||||
int insnCount = instructions.size();
|
int insnCount = instructions.size();
|
||||||
for (int i = 0; i < insnCount; i++) {
|
for (int i = 0; i < insnCount; i++) {
|
||||||
val insn = instructions.get(i);
|
val insn = instructions.get(i);
|
||||||
if (insn instanceof FieldInsnNode) {
|
if (insn instanceof FieldInsnNode) {
|
||||||
val field = (FieldInsnNode) insn;
|
val field = (FieldInsnNode) insn;
|
||||||
if (field.getOpcode() == Opcodes.GETSTATIC &&
|
if (field.getOpcode() == Opcodes.GETSTATIC && field.owner.equals("net/minecraft/init/Blocks")) {
|
||||||
field.owner.equals("net/minecraft/init/Blocks")) {
|
for (val blockField : blocks.fields) {
|
||||||
for (val blockField: blocks.fields) {
|
if (blockField.name.equals(field.name) && !blockField.desc.equals(field.desc)) {
|
||||||
if (blockField.name.equals(field.name) &&
|
|
||||||
!blockField.desc.equals(field.desc)) {
|
|
||||||
field.desc = blockField.desc;
|
field.desc = blockField.desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,7 +22,7 @@ public class FmlRegistry implements IClassNodeTransformer {
|
|||||||
}
|
}
|
||||||
field = AsmUtil.findField(cn, "MAX_ITEM_ID", true);
|
field = AsmUtil.findField(cn, "MAX_ITEM_ID", true);
|
||||||
if (field != null) {
|
if (field != null) {
|
||||||
field.value = ExtendedConstants.maxBlockID;
|
field.value = ExtendedConstants.maxItemID;
|
||||||
}
|
}
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (final MethodNode method : cn.methods) {
|
for (final MethodNode method : cn.methods) {
|
||||||
@@ -30,7 +30,7 @@ public class FmlRegistry implements IClassNodeTransformer {
|
|||||||
ExtendedConstants.maxBlockID, true)) {
|
ExtendedConstants.maxBlockID, true)) {
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxBlockID, true);
|
AsmUtil.transformInlinedSizeMethod(cn, method, 31999, ExtendedConstants.maxItemID, true);
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw new AsmTransformException("can't find 4095 constant in any method");
|
throw new AsmTransformException("can't find 4095 constant in any method");
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.falsepattern.endlessids.asm.transformer;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.asm.IClassNodeTransformer;
|
||||||
|
import com.falsepattern.endlessids.asm.IETransformer;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.objectweb.asm.tree.ClassNode;
|
||||||
|
import org.objectweb.asm.tree.FieldInsnNode;
|
||||||
|
import org.objectweb.asm.tree.FieldNode;
|
||||||
|
import org.objectweb.asm.tree.InsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodInsnNode;
|
||||||
|
import org.objectweb.asm.tree.MethodNode;
|
||||||
|
import org.objectweb.asm.tree.VarInsnNode;
|
||||||
|
|
||||||
|
public class GameDataAccelerator implements IClassNodeTransformer {
|
||||||
|
private static final int MASK_REGISTER_BLOCK = 0b1;
|
||||||
|
private static final int MASK_REGISTER_ITEM = 0b10;
|
||||||
|
@Override
|
||||||
|
public void transform(ClassNode classNode, boolean obfuscated) {
|
||||||
|
var cacheField = new FieldNode(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, "endlessIDsItemBlockCache", "Lcom/falsepattern/endlessids/util/WeakIdentityHashMap;", null, null);
|
||||||
|
classNode.fields.add(cacheField);
|
||||||
|
int tweaksLeft = MASK_REGISTER_BLOCK | MASK_REGISTER_ITEM;
|
||||||
|
for (val method: classNode.methods) {
|
||||||
|
if ((tweaksLeft & MASK_REGISTER_BLOCK) != 0 &&
|
||||||
|
method.name.equals("registerBlock") &&
|
||||||
|
method.desc.equals("(Lnet/minecraft/block/Block;Ljava/lang/String;I)I")) {
|
||||||
|
transformRegisterBlock(method);
|
||||||
|
tweaksLeft &= ~MASK_REGISTER_BLOCK;
|
||||||
|
}
|
||||||
|
if ((tweaksLeft & MASK_REGISTER_ITEM) != 0 &&
|
||||||
|
method.name.equals("registerItem") &&
|
||||||
|
method.desc.equals("(Lnet/minecraft/item/Item;Ljava/lang/String;I)I")) {
|
||||||
|
transformRegisterItem(method);
|
||||||
|
tweaksLeft &= ~MASK_REGISTER_ITEM;
|
||||||
|
}
|
||||||
|
if (tweaksLeft == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tweaksLeft != 0) {
|
||||||
|
IETransformer.logger.error("Could not accelerate block registration!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformRegisterItem(MethodNode method) {
|
||||||
|
var iter = method.instructions.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
var insn = iter.next();
|
||||||
|
if (!(insn instanceof FieldInsnNode))
|
||||||
|
continue;
|
||||||
|
var typeInsn = (FieldInsnNode) insn;
|
||||||
|
if (!(typeInsn.owner.equals("net/minecraft/item/ItemBlock") &&
|
||||||
|
typeInsn.name.equals("field_150939_a") &&
|
||||||
|
typeInsn.desc.equals("Lnet/minecraft/block/Block;")))
|
||||||
|
continue;
|
||||||
|
iter.previous();
|
||||||
|
iter.add(new InsnNode(Opcodes.DUP));
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
iter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/falsepattern/endlessids/asm/GameDataHooks", "cacheItemBlock", "(Lnet/minecraft/item/ItemBlock;Lcpw/mods/fml/common/registry/GameData;)V", false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
transformError(method);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void transformError(MethodNode method) {
|
||||||
|
IETransformer.logger.error("Could not add caching code to GameData." + method.name + method.desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void transformRegisterBlock(MethodNode method) {
|
||||||
|
var iter = method.instructions.iterator();
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
var insn = iter.next();
|
||||||
|
if (!(insn instanceof FieldInsnNode))
|
||||||
|
continue;
|
||||||
|
var fieldInsn = (FieldInsnNode) insn;
|
||||||
|
if (!(fieldInsn.owner.equals("cpw/mods/fml/common/registry/GameData") &&
|
||||||
|
fieldInsn.name.equals("iItemRegistry") &&
|
||||||
|
fieldInsn.desc.equals("Lcpw/mods/fml/common/registry/FMLControlledNamespacedRegistry;")))
|
||||||
|
continue;
|
||||||
|
iter.previous();
|
||||||
|
iter.previous();
|
||||||
|
iter.remove();
|
||||||
|
iter.next();
|
||||||
|
iter.remove();
|
||||||
|
iter.next();
|
||||||
|
iter.remove();
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ALOAD, 1));
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||||
|
iter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/falsepattern/endlessids/asm/GameDataHooks", "fetchCachedItemBlock", "(Lnet/minecraft/block/Block;Lcpw/mods/fml/common/registry/GameData;)Lnet/minecraft/item/ItemBlock;", false));
|
||||||
|
iter.add(new VarInsnNode(Opcodes.ASTORE, 4));
|
||||||
|
iter.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "com/falsepattern/endlessids/asm/GameDataHooks", "fakeIterable", "()Ljava/lang/Iterable;", false));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
transformError(method);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -12,7 +12,7 @@ public class SpaceCoreModInfoGenerator implements IClassNodeTransformer {
|
|||||||
if (obfuscated) {
|
if (obfuscated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (val method: cn.methods) {
|
for (val method : cn.methods) {
|
||||||
if (method.name.equals("generate")) {
|
if (method.name.equals("generate")) {
|
||||||
val iterator = method.instructions.iterator();
|
val iterator = method.instructions.iterator();
|
||||||
iterator.add(new InsnNode(Opcodes.RETURN));
|
iterator.add(new InsnNode(Opcodes.RETURN));
|
||||||
|
|||||||
@@ -5,45 +5,48 @@ import com.falsepattern.endlessids.constants.ExtendedConstants;
|
|||||||
import com.falsepattern.lib.config.Config;
|
import com.falsepattern.lib.config.Config;
|
||||||
import com.falsepattern.lib.config.ConfigurationManager;
|
import com.falsepattern.lib.config.ConfigurationManager;
|
||||||
|
|
||||||
@Config(modid = Tags.MODID, category = "darkworld")
|
@Config(modid = Tags.MODID,
|
||||||
|
category = "darkworld")
|
||||||
public class DarkWorldIDConfig {
|
public class DarkWorldIDConfig {
|
||||||
static {
|
|
||||||
ConfigurationManager.selfInit();
|
|
||||||
}
|
|
||||||
@Config.Comment("Original: 100")
|
@Config.Comment("Original: 100")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1100)
|
@Config.DefaultInt(1100)
|
||||||
public static int darkOceanID;
|
public static int darkOceanID;
|
||||||
|
|
||||||
@Config.Comment("Original: 101")
|
@Config.Comment("Original: 101")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1101)
|
@Config.DefaultInt(1101)
|
||||||
public static int darkPlainsID;
|
public static int darkPlainsID;
|
||||||
|
|
||||||
@Config.Comment("Original: 102")
|
@Config.Comment("Original: 102")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1102)
|
@Config.DefaultInt(1102)
|
||||||
public static int darkDesertID;
|
public static int darkDesertID;
|
||||||
|
|
||||||
@Config.Comment("Original: 103")
|
@Config.Comment("Original: 103")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1103)
|
@Config.DefaultInt(1103)
|
||||||
public static int darkHillsID;
|
public static int darkHillsID;
|
||||||
|
|
||||||
@Config.Comment("Original: 104")
|
@Config.Comment("Original: 104")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1104)
|
@Config.DefaultInt(1104)
|
||||||
public static int darkForestID;
|
public static int darkForestID;
|
||||||
|
|
||||||
@Config.Comment("Original: 105")
|
@Config.Comment("Original: 105")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1105)
|
@Config.DefaultInt(1105)
|
||||||
public static int darkTaigaID;
|
public static int darkTaigaID;
|
||||||
|
|
||||||
@Config.Comment("Original: 106")
|
@Config.Comment("Original: 106")
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
@Config.DefaultInt(1106)
|
@Config.DefaultInt(1106)
|
||||||
public static int darkSwampID;
|
public static int darkSwampID;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ConfigurationManager.selfInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,13 +5,16 @@ import com.falsepattern.endlessids.constants.ExtendedConstants;
|
|||||||
import com.falsepattern.lib.config.Config;
|
import com.falsepattern.lib.config.Config;
|
||||||
import com.falsepattern.lib.config.ConfigurationManager;
|
import com.falsepattern.lib.config.ConfigurationManager;
|
||||||
|
|
||||||
@Config(modid = Tags.MODID, category = "futurepack")
|
@Config(modid = Tags.MODID,
|
||||||
|
category = "futurepack")
|
||||||
public class FuturepackIDConfig {
|
public class FuturepackIDConfig {
|
||||||
|
@Config.Comment("Original: 97")
|
||||||
|
@Config.RangeInt(min = 40,
|
||||||
|
max = ExtendedConstants.biomeIDCount - 1)
|
||||||
|
@Config.DefaultInt(2097)
|
||||||
|
public static int spaceID;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
ConfigurationManager.selfInit();
|
ConfigurationManager.selfInit();
|
||||||
}
|
}
|
||||||
@Config.Comment("Original: 97")
|
|
||||||
@Config.RangeInt(min = 40, max = ExtendedConstants.biomeIDCount - 1)
|
|
||||||
@Config.DefaultInt(2097)
|
|
||||||
public static int spaceID;
|
|
||||||
}
|
}
|
||||||
@@ -6,28 +6,93 @@ import com.falsepattern.lib.config.ConfigurationManager;
|
|||||||
|
|
||||||
@Config(modid = Tags.MODID)
|
@Config(modid = Tags.MODID)
|
||||||
public class GeneralConfig {
|
public class GeneralConfig {
|
||||||
static {
|
@Config.Comment(
|
||||||
ConfigurationManager.selfInit();
|
"WARNING: THIS CONFIG IS EXTREMELY SENSITIVE TO CHANGES, DISABLING STUFF ONCE THEY HAVE BEEN ENABLED\n" +
|
||||||
}
|
"CAN CORRUPT YOUR WORLD! ONLY TOUCH THIS FILE IF YOU KNOW WHAT YOU'RE DOING!\n" +
|
||||||
|
"This file should only be edited by modpack developers to finetune it for the modpack. Once an option\n" +
|
||||||
|
"has been enabled, it modifies the chunk save data format, which is (partially) compatible with\n" +
|
||||||
|
"vanilla, but removing the mod might cause block/item corruption for higher IDs.\n" +
|
||||||
|
"Additional note: Every client and server must have the exact same config, this also affects netcode.")
|
||||||
|
@Config.DefaultString("")
|
||||||
|
public static String __NOTICE__;
|
||||||
|
@Config.Comment("Throw an exception when an invalid block is registered. FOR DEBUGGING PURPOSES")
|
||||||
@Config.DefaultBoolean(false)
|
@Config.DefaultBoolean(false)
|
||||||
public static boolean catchUnregisteredBlocks;
|
public static boolean catchUnregisteredBlocks;
|
||||||
|
@Config.Comment("Remove invalid (corrupted) blocks from the game. FOR DEBUGGING PURPOSES")
|
||||||
@Config.Comment("Remove invalid (corrupted) blocks from the game.")
|
|
||||||
@Config.DefaultBoolean(false)
|
@Config.DefaultBoolean(false)
|
||||||
public static boolean removeInvalidBlocks;
|
public static boolean removeInvalidBlocks;
|
||||||
|
@Config.Comment("Extend Biome IDs. Vanilla limit is 256, new limit is 65536.")
|
||||||
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.")
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendBiome;
|
||||||
|
@Config.Comment("Extend Block and Item IDs. Vanilla limit is 4096/32000, new limit is 16777216 for both.\n" +
|
||||||
|
"See also: countCorrectionBits")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendBlockItem;
|
||||||
|
@Config.Comment("Extend DataWatcher IDs. Vanilla limit is 31, new limit is 127.\n" +
|
||||||
|
"Disabled by default because of uncertain/weak implementation (taken from NotEnoughIDs)")
|
||||||
@Config.DefaultBoolean(false)
|
@Config.DefaultBoolean(false)
|
||||||
public static boolean extendDataWatcher;
|
public static boolean extendDataWatcher;
|
||||||
|
@Config.Comment("Extend Enchantment IDs. Vanilla limit is 256, new limit is 32768.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendEnchantment;
|
||||||
|
@Config.Comment("Extend Potion IDs. Vanilla limit is 32, new limit is 65536.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendPotion;
|
||||||
|
@Config.Comment("Extend Entity IDs. Vanilla limit is 256, new limit is 32768.")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean extendEntity;
|
||||||
|
|
||||||
|
@Config.Comment("Improves the speed of the block registry by multiple orders of magnitudes. (not thoroughly tested yet)\n" +
|
||||||
|
"It's highly recommended to leave this enabled, especially when using a lot of IDs.\n" +
|
||||||
|
"With this disabled, registering 1 million blocks on a test system took 80 minutes\n" +
|
||||||
|
"With this enabled, registering the same million blocks took 7 seconds")
|
||||||
|
@Config.DefaultBoolean(true)
|
||||||
|
public static boolean enableRegistryPerformanceTweak;
|
||||||
@Config.Comment(
|
@Config.Comment(
|
||||||
"Setting this value greater than 0 will reduce RAM usage, at the cost of less available Block IDs.\n" +
|
"Extends the maximum redstone signal strength.\n" + "Only has effect with extendBlockItem enabled.\n" +
|
||||||
"Notice: This does not affect ITEM IDs.\n" +
|
"WARNING: THIS IS HERE ONLY FOR FUN, IT WILL DEFINITELY CORRUPT YOUR WORLD!")
|
||||||
"By default, block IDs can also go up to 16 Million, and each additional bit in this setting halves\n" +
|
@Config.DefaultBoolean(false)
|
||||||
"this value.\n" +
|
public static boolean extendRedstone;
|
||||||
"(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.Comment("Increases the max signal strength of redstone.\n" +
|
||||||
|
"Only has effect with both extendBlockItem and extendRedstone enabled.\n" + "Vanilla value is 15.")
|
||||||
|
@Config.RangeInt(min = 15,
|
||||||
|
max = 127)
|
||||||
|
@Config.DefaultInt(15)
|
||||||
|
public static int maxRedstone;
|
||||||
|
@Config.Comment("Use this to tune the amount of available block IDs.\n" +
|
||||||
|
"Minecraft contains some internal code that uses a HUGE amount of RAM with too many block IDs available.\n" +
|
||||||
|
"Notice: This does not affect ITEM IDs.\n" +
|
||||||
|
"The vanilla default is 4k block IDs, while the maximum is 16 million.\n" +
|
||||||
|
"The default setting sets it to 4k (vanilla).\n" +
|
||||||
|
"increase if necessary (when running out of BLOCK IDs in your modpack)\n" +
|
||||||
|
"Only effective if extendBlockItem is enabled.\n" +
|
||||||
|
"Effective values: (0: 4k, 1: 8k, 2: 16k, 3: 32k, 4: 64k, 5: 128k, 6: 256k, 7: 512k, 8: 1M, 9: 2M, 10: 4M, 11: 8M, 12: 16M)\n" +
|
||||||
|
"The effective value of this variable must always be smaller or equal to the effective value of extraItemIDBits")
|
||||||
@Config.RangeInt(min = 0,
|
@Config.RangeInt(min = 0,
|
||||||
max = 12)
|
max = 12)
|
||||||
@Config.DefaultInt(0)
|
@Config.DefaultInt(0)
|
||||||
|
public static int extraBlockIDBits;
|
||||||
|
@Config.Comment("Use this to tune the amount of available item IDs.\n" +
|
||||||
|
"The vanilla default is 32k item IDs, while the maximum is 16 million.\n" +
|
||||||
|
"The default setting sets it to 32k (vanilla).\n" +
|
||||||
|
"increase if necessary (when running out of ITEM IDs in your modpack)\n" +
|
||||||
|
"Only effective if extendBlockItem is enabled.\n" +
|
||||||
|
"Effective values: (0: 32k, 1: 64k, 2: 128k, 3: 256k, 4: 512k, 5: 1M, 6: 2M, 7: 4M, 8: 8M, 9: 16M)\n" +
|
||||||
|
"The effective value of this variable must always be equal or larger than the effective value of extraBlockIDBits")
|
||||||
|
@Config.RangeInt(min = 0,
|
||||||
|
max = 9)
|
||||||
|
@Config.DefaultInt(0)
|
||||||
|
public static int extraItemIDBits;
|
||||||
|
|
||||||
|
|
||||||
|
@Config.Comment("DEPRECATED, will be removed in the next version of EndlessIDs!\n" +
|
||||||
|
"This property does nothing.\n" +
|
||||||
|
"Use extraBlockIDBits and extraItemIDBits instead.")
|
||||||
|
@Config.DefaultInt(0)
|
||||||
|
@Deprecated
|
||||||
public static int countCorrectionBits;
|
public static int countCorrectionBits;
|
||||||
|
|
||||||
|
static {
|
||||||
|
ConfigurationManager.selfInit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,15 +2,23 @@ package com.falsepattern.endlessids.constants;
|
|||||||
|
|
||||||
import com.falsepattern.endlessids.config.GeneralConfig;
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class ExtendedConstants {
|
public class ExtendedConstants {
|
||||||
//Tunables
|
//Tunables
|
||||||
public static final int bitsPerID = 24;
|
public static final int bitsPerID = 24;
|
||||||
public static final int bitsPerMetadata = 4;
|
public static final int bitsPerMetadata = 16;
|
||||||
public static final int countCorrectionBits = GeneralConfig.countCorrectionBits;
|
public static final int countCorrectionItemBits = 9 - GeneralConfig.extraItemIDBits;
|
||||||
|
public static final int countCorrectionBlockBits = 12 - GeneralConfig.extraBlockIDBits;
|
||||||
|
|
||||||
public static final int watchableBits = 7;
|
public static final int watchableBits = 7;
|
||||||
public static final int bitsPerBiome = 16;
|
public static final int bitsPerBiome = 16;
|
||||||
|
|
||||||
|
public static final int maximumPotionIDs = 65536;
|
||||||
|
public static final int maximumEnchantmentIDs = 32768;
|
||||||
|
|
||||||
|
//Align with max item metadata for spawn eggs. Will be treated as short in netcode
|
||||||
|
public static final int bitsPerEntity = 15;
|
||||||
|
|
||||||
//BlockItemIDs
|
//BlockItemIDs
|
||||||
public static final int nibblesPerID = bitsPerID / 4;
|
public static final int nibblesPerID = bitsPerID / 4;
|
||||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||||
@@ -18,9 +26,12 @@ public class ExtendedConstants {
|
|||||||
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;
|
||||||
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
|
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBlockBits);
|
||||||
public static final int maxBlockID = blockIDCount - 1;
|
public static final int maxBlockID = blockIDCount - 1;
|
||||||
|
|
||||||
|
public static final int itemIDCount = 1 << (bitsPerID - countCorrectionItemBits);
|
||||||
|
public static final int maxItemID = itemIDCount - 1;
|
||||||
|
|
||||||
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;
|
||||||
@@ -31,10 +42,14 @@ public class ExtendedConstants {
|
|||||||
public static final int biomeIDMask = biomeIDCount - 1;
|
public static final int biomeIDMask = biomeIDCount - 1;
|
||||||
public static final int biomeIDNull = biomeIDMask;
|
public static final int biomeIDNull = biomeIDMask;
|
||||||
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
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;
|
||||||
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
||||||
|
|
||||||
|
//EntityIDs
|
||||||
|
public static final int entityIDCount = 1 << bitsPerEntity;
|
||||||
|
public static final int entityIDMask = entityIDCount - 1;
|
||||||
|
public static final int maxEntityID = entityIDMask;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.falsepattern.endlessids.constants;
|
package com.falsepattern.endlessids.constants;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class VanillaConstants {
|
public class VanillaConstants {
|
||||||
//Tunables
|
//Tunables
|
||||||
public static final int bitsPerID = 12;
|
public static final int bitsPerID = 12;
|
||||||
@@ -9,6 +10,8 @@ public class VanillaConstants {
|
|||||||
public static final int watchableBits = 5;
|
public static final int watchableBits = 5;
|
||||||
public static final int bitsPerBiome = 8;
|
public static final int bitsPerBiome = 8;
|
||||||
|
|
||||||
|
public static final int bitsPerEntity = 8;
|
||||||
|
|
||||||
//BlockItemIDs
|
//BlockItemIDs
|
||||||
public static final int nibblesPerID = bitsPerID / 4;
|
public static final int nibblesPerID = bitsPerID / 4;
|
||||||
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
public static final int bytesPerID = (nibblesPerID + 1) / 2;
|
||||||
@@ -19,6 +22,9 @@ public class VanillaConstants {
|
|||||||
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
|
public static final int blockIDCount = 1 << (bitsPerID - countCorrectionBits);
|
||||||
public static final int maxBlockID = blockIDCount - 1;
|
public static final int maxBlockID = blockIDCount - 1;
|
||||||
|
|
||||||
|
public static final int itemIDCount = 32000;
|
||||||
|
public static final int maxItemID = itemIDCount - 1;
|
||||||
|
|
||||||
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;
|
||||||
@@ -29,10 +35,13 @@ public class VanillaConstants {
|
|||||||
public static final int biomeIDMask = biomeIDCount - 1;
|
public static final int biomeIDMask = biomeIDCount - 1;
|
||||||
public static final int biomeIDNull = biomeIDMask;
|
public static final int biomeIDNull = biomeIDMask;
|
||||||
public static final int bytesPerBiome = (bitsPerBiome + 7) / 8;
|
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;
|
||||||
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
public static final int watchableMask = (0x7 << watchableBits) | maxWatchableID;
|
||||||
|
|
||||||
|
//EntityIDs
|
||||||
|
public static final int entityIDCount = 1 << bitsPerEntity;
|
||||||
|
public static final int maxEntityID = entityIDCount - 1;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class BiomeContainer extends _Dummy {
|
||||||
|
public BiomeContainer() {
|
||||||
|
super("biome", "Biome");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class BlockItemContainer extends _Dummy {
|
||||||
|
public BlockItemContainer() {
|
||||||
|
super("blockitem", "BlockItem");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class DataWatcherContainer extends _Dummy {
|
||||||
|
public DataWatcherContainer() {
|
||||||
|
super("datawatcher", "DataWatcher");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class EnchantmentContainer extends _Dummy {
|
||||||
|
public EnchantmentContainer() {
|
||||||
|
super("enchantment", "Enchantment");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
public class PotionContainer extends _Dummy {
|
||||||
|
public PotionContainer() {
|
||||||
|
super("potion", "Potion");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.falsepattern.endlessids.containers;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
import lombok.val;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.DummyModContainer;
|
||||||
|
import cpw.mods.fml.common.LoadController;
|
||||||
|
import cpw.mods.fml.common.ModMetadata;
|
||||||
|
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
|
||||||
|
|
||||||
|
public class _Dummy extends DummyModContainer {
|
||||||
|
public _Dummy(String id, String name) {
|
||||||
|
super(createMetadata(id, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ModMetadata createMetadata(String id, String name) {
|
||||||
|
val meta = new ModMetadata();
|
||||||
|
meta.modId = Tags.MODID + "_" + id;
|
||||||
|
meta.name = Tags.MODNAME + " " + name + " Module";
|
||||||
|
meta.version = Tags.VERSION;
|
||||||
|
meta.dependencies.add(new DefaultArtifactVersion(Tags.MODID, Tags.VERSION));
|
||||||
|
meta.parent = Tags.MODID;
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean registerBus(EventBus bus, LoadController controller) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.falsepattern.endlessids.managers;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ChunkDataManager;
|
||||||
|
import com.falsepattern.endlessids.Hooks;
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
|
import lombok.var;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
public class BiomeManager implements ChunkDataManager, ChunkDataManager.PacketDataManager, ChunkDataManager.ChunkNBTDataManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String domain() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return "biome";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSize() {
|
||||||
|
return 2 * 16 * 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||||
|
data.asShortBuffer().put(((IChunkMixin)chunk).getBiomeShortArray());
|
||||||
|
data.position(data.position() + maxPacketSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||||
|
var arr = ((IChunkMixin)chunk).getBiomeShortArray();
|
||||||
|
if (arr == null) {
|
||||||
|
arr = new short[16 * 16];
|
||||||
|
((IChunkMixin)chunk).setBiomeShortArray(arr);
|
||||||
|
}
|
||||||
|
buffer.asShortBuffer().get(arr);
|
||||||
|
buffer.position(buffer.position() + maxPacketSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean chunkPrivilegedAccess() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeChunkToNBT(Chunk chunk, NBTTagCompound nbt) {
|
||||||
|
byte[] arr = Hooks.shortToByteArray(((IChunkMixin)chunk).getBiomeShortArray());
|
||||||
|
nbt.setByteArray("Biomes16v2", arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readChunkFromNBT(Chunk chunk, NBTTagCompound nbt) {
|
||||||
|
var data = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
|
if (data == null) {
|
||||||
|
data = new short[16 * 16];
|
||||||
|
((IChunkMixin)chunk).setBiomeShortArray(data);
|
||||||
|
}
|
||||||
|
if (nbt.hasKey("Biomes16v2", 7)) {
|
||||||
|
Hooks.byteToShortArray(nbt.getByteArray("Biomes16v2"), 0, data, 0, data.length * 2);
|
||||||
|
} else if (nbt.hasKey("Biomes16", 7)) { //NotEnoughBiomes DFU
|
||||||
|
Hooks.byteToShortArrayLegacy(nbt.getByteArray("Biomes16"), data);
|
||||||
|
} else if (nbt.hasKey("Biomes", 7)) { //Vanilla DFU
|
||||||
|
Hooks.scatter(nbt.getByteArray("Biomes"), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
package com.falsepattern.endlessids.managers;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ChunkDataManager;
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
public class BlockIDManager implements ChunkDataManager, ChunkDataManager.PacketDataManager, ChunkDataManager.SectionNBTDataManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String domain() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return "blockid";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSize() {
|
||||||
|
return 3 * 16 * 16 * 16 * 16 + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||||
|
val ebsList = chunk.getBlockStorageArray();
|
||||||
|
int storageFlags = 0;
|
||||||
|
val start = data.position() + 4;
|
||||||
|
data.position(start);
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||||
|
|
||||||
|
storageFlags |= ebs.getEBSMSBMask() << (i * 2);
|
||||||
|
|
||||||
|
val b1 = ebs.getB1();
|
||||||
|
data.put(b1);
|
||||||
|
|
||||||
|
val b2Low = ebs.getB2Low();
|
||||||
|
if (b2Low == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.put(b2Low.data);
|
||||||
|
|
||||||
|
val b2High = ebs.getB2High();
|
||||||
|
if (b2High == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.put(b2High.data);
|
||||||
|
|
||||||
|
val b3 = ebs.getB3();
|
||||||
|
if (b3 != null) {
|
||||||
|
data.put(b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.putInt(start - 4, storageFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||||
|
val ebsList = chunk.getBlockStorageArray();
|
||||||
|
val storageFlags = buffer.getInt();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||||
|
val storageFlag = (storageFlags >>> (i * 2)) & 3;
|
||||||
|
val b1 = ebs.getB1();
|
||||||
|
buffer.get(b1);
|
||||||
|
if (storageFlag == 0b00) {
|
||||||
|
ebs.clearB2Low();
|
||||||
|
ebs.clearB2High();
|
||||||
|
ebs.clearB3();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var b2Low = ebs.getB2Low();
|
||||||
|
if (b2Low == null) {
|
||||||
|
b2Low = ebs.createB2Low();
|
||||||
|
}
|
||||||
|
buffer.get(b2Low.data);
|
||||||
|
if (storageFlag == 0b01) {
|
||||||
|
ebs.clearB2High();
|
||||||
|
ebs.clearB3();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var b2High = ebs.getB2High();
|
||||||
|
if (b2High == null) {
|
||||||
|
b2High = ebs.createB2High();
|
||||||
|
}
|
||||||
|
buffer.get(b2High.data);
|
||||||
|
if (storageFlag == 0b10) {
|
||||||
|
ebs.clearB3();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var b3 = ebs.getB3();
|
||||||
|
if (b3 == null) {
|
||||||
|
b3 = ebs.createB3();
|
||||||
|
}
|
||||||
|
buffer.get(b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean sectionPrivilegedAccess() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSectionToNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||||
|
val b1 = ebs.getB1();
|
||||||
|
val b2Low = ebs.getB2Low();
|
||||||
|
val b2High = ebs.getB2High();
|
||||||
|
val b3 = ebs.getB3();
|
||||||
|
section.setByteArray("Blocks", b1);
|
||||||
|
if (b2Low != null) {
|
||||||
|
section.setByteArray("Add", b2Low.data);
|
||||||
|
}
|
||||||
|
if (b2High != null) {
|
||||||
|
section.setByteArray("BlocksB2Hi", b2High.data);
|
||||||
|
}
|
||||||
|
if (b3 != null) {
|
||||||
|
section.setByteArray("BlocksB3", b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//NotEnoughIDs world compatibility
|
||||||
|
public static void readSectionFromNBTNotEnoughIDsDFU(IExtendedBlockStorageMixin ebs, NBTTagCompound section) {
|
||||||
|
val data = section.getByteArray("Blocks16");
|
||||||
|
val dataShort = new short[data.length >>> 1];
|
||||||
|
ByteBuffer.wrap(data).asShortBuffer().get(dataShort);
|
||||||
|
val b1 = new byte[dataShort.length];
|
||||||
|
val b2L = new byte[dataShort.length >>> 1];
|
||||||
|
val b2H = new byte[dataShort.length >>> 1];
|
||||||
|
for (int i = 0; i < dataShort.length; i++) {
|
||||||
|
val s = dataShort[i];
|
||||||
|
val nI = i >>> 1;
|
||||||
|
val mI = (i & 1) * 4;
|
||||||
|
b1[i] = (byte) (s & 0x00FF);
|
||||||
|
b2L[nI] |= ((s & 0x0F00) >>> 8) << mI;
|
||||||
|
b2H[nI] |= ((s & 0xF000) >>> 12) << mI;
|
||||||
|
}
|
||||||
|
ebs.setB1(b1);
|
||||||
|
ebs.setB2Low(new NibbleArray(b2L, 4));
|
||||||
|
ebs.setB2High(new NibbleArray(b2H, 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSectionFromNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||||
|
if (section.hasKey("Blocks16")) {
|
||||||
|
readSectionFromNBTNotEnoughIDsDFU(ebs, section);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
assert section.hasKey("Blocks");
|
||||||
|
val b1 = section.getByteArray("Blocks");
|
||||||
|
final byte[] b2Low = section.hasKey("Add") ? section.getByteArray("Add") : null;
|
||||||
|
final byte[] b2High = section.hasKey("BlocksB2Hi") ? section.getByteArray("BlocksB2Hi") : null;
|
||||||
|
final byte[] b3 = section.hasKey("BlocksB3") ? section.getByteArray("BlocksB3") : null;
|
||||||
|
|
||||||
|
ebs.setB1(b1);
|
||||||
|
if (b2Low == null) {
|
||||||
|
ebs.clearB2Low();
|
||||||
|
} else {
|
||||||
|
ebs.setB2Low(new NibbleArray(b2Low, 4));
|
||||||
|
}
|
||||||
|
if (b2High == null) {
|
||||||
|
ebs.clearB2High();
|
||||||
|
} else {
|
||||||
|
ebs.setB2High(new NibbleArray(b2High, 4));
|
||||||
|
}
|
||||||
|
ebs.setB3(b3);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.falsepattern.endlessids.managers;
|
||||||
|
|
||||||
|
import com.falsepattern.chunk.api.ChunkDataManager;
|
||||||
|
import com.falsepattern.endlessids.Tags;
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
||||||
|
import lombok.val;
|
||||||
|
import lombok.var;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
|
public class BlockMetaManager implements ChunkDataManager, ChunkDataManager.PacketDataManager, ChunkDataManager.SectionNBTDataManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String domain() {
|
||||||
|
return Tags.MODID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String id() {
|
||||||
|
return "metadata";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int maxPacketSize() {
|
||||||
|
return 2 * 16 * 16 * 16 * 16 + 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer data) {
|
||||||
|
val ebsList = chunk.getBlockStorageArray();
|
||||||
|
int storageFlags = 0;
|
||||||
|
val start = data.position() + 4;
|
||||||
|
data.position(start);
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||||
|
|
||||||
|
storageFlags |= ebs.getEBSMask() << (i * 2);
|
||||||
|
|
||||||
|
val m1Low = ebs.getM1Low();
|
||||||
|
data.put(m1Low.data);
|
||||||
|
|
||||||
|
val m1High = ebs.getM1High();
|
||||||
|
if (m1High == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
data.put(m1High.data);
|
||||||
|
|
||||||
|
val m2 = ebs.getM2();
|
||||||
|
if (m2 != null) {
|
||||||
|
data.put(m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.putInt(start - 4, storageFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromBuffer(Chunk chunk, int ebsMask, boolean forceUpdate, ByteBuffer buffer) {
|
||||||
|
val ebsList = chunk.getBlockStorageArray();
|
||||||
|
val storageFlags = buffer.getInt();
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
if ((ebsMask & (1 << i)) == 0 || ebsList[i] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsList[i];
|
||||||
|
val storageFlag = (storageFlags >>> (i * 2)) & 3;
|
||||||
|
val m1Low = ebs.getM1Low();
|
||||||
|
buffer.get(m1Low.data);
|
||||||
|
if (storageFlag == 0b01) {
|
||||||
|
ebs.clearM1High();
|
||||||
|
ebs.clearM2();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var m1High = ebs.getM1High();
|
||||||
|
if (m1High == null) {
|
||||||
|
m1High = ebs.createM1High();
|
||||||
|
}
|
||||||
|
buffer.get(m1High.data);
|
||||||
|
if (storageFlag == 0b10) {
|
||||||
|
ebs.clearM2();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
var m2 = ebs.getM2();
|
||||||
|
if (m2 == null) {
|
||||||
|
m2 = ebs.createM2();
|
||||||
|
}
|
||||||
|
buffer.get(m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean sectionPrivilegedAccess() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeSectionToNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||||
|
val m1Low = ebs.getM1Low();
|
||||||
|
val m1High = ebs.getM1High();
|
||||||
|
val m2 = ebs.getM2();
|
||||||
|
section.setByteArray("Data", m1Low.data);
|
||||||
|
if (m1High != null) {
|
||||||
|
section.setByteArray("Data1High", m1High.data);
|
||||||
|
}
|
||||||
|
if (m2 != null) {
|
||||||
|
section.setByteArray("Data2", m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readSectionFromNBT(Chunk chunk, ExtendedBlockStorage ebsVanilla, NBTTagCompound section) {
|
||||||
|
val ebs = (IExtendedBlockStorageMixin) ebsVanilla;
|
||||||
|
assert section.hasKey("Data");
|
||||||
|
val m1Low = section.getByteArray("Data");
|
||||||
|
final byte[] m1High = section.hasKey("Data1High") ? section.getByteArray("Data1High") : null;
|
||||||
|
final byte[] m2 = section.hasKey("Data2") ? section.getByteArray("Data2") : null;
|
||||||
|
|
||||||
|
ebs.setM1Low(new NibbleArray(m1Low, 4));
|
||||||
|
if (m1High == null) {
|
||||||
|
ebs.clearM1High();
|
||||||
|
} else {
|
||||||
|
ebs.setM1High(new NibbleArray(m1High, 4));
|
||||||
|
}
|
||||||
|
ebs.setM2(m2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import java.lang.reflect.Field;
|
|||||||
|
|
||||||
public class GalaxySpaceHelper {
|
public class GalaxySpaceHelper {
|
||||||
private static final Field GSSpaceField;
|
private static final Field GSSpaceField;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Class<?> clazz;
|
Class<?> clazz;
|
||||||
try {
|
try {
|
||||||
|
|||||||
+52
-4
@@ -1,11 +1,59 @@
|
|||||||
package com.falsepattern.endlessids.mixin.helpers;
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
import net.minecraft.world.chunk.NibbleArray;
|
||||||
|
|
||||||
public interface IExtendedBlockStorageMixin {
|
public interface IExtendedBlockStorageMixin {
|
||||||
void setBlockRefCount(int value);
|
byte[] getB1();
|
||||||
|
|
||||||
void setTickRefCount(int value);
|
void setB1(byte[] data);
|
||||||
|
|
||||||
short[] getLSB();
|
NibbleArray getB2Low();
|
||||||
|
|
||||||
byte[] getMSB();
|
void setB2Low(NibbleArray data);
|
||||||
|
|
||||||
|
void clearB2Low();
|
||||||
|
|
||||||
|
NibbleArray createB2Low();
|
||||||
|
|
||||||
|
NibbleArray getB2High();
|
||||||
|
|
||||||
|
void setB2High(NibbleArray data);
|
||||||
|
|
||||||
|
void clearB2High();
|
||||||
|
|
||||||
|
NibbleArray createB2High();
|
||||||
|
|
||||||
|
byte[] getB3();
|
||||||
|
|
||||||
|
void setB3(byte[] data);
|
||||||
|
|
||||||
|
void clearB3();
|
||||||
|
|
||||||
|
byte[] createB3();
|
||||||
|
|
||||||
|
int getEBSMask();
|
||||||
|
|
||||||
|
int getEBSMSBMask();
|
||||||
|
|
||||||
|
int getID(int x, int y, int z);
|
||||||
|
|
||||||
|
NibbleArray getM1Low();
|
||||||
|
|
||||||
|
void setM1Low(NibbleArray m1Low);
|
||||||
|
|
||||||
|
NibbleArray getM1High();
|
||||||
|
|
||||||
|
void setM1High(NibbleArray m1High);
|
||||||
|
|
||||||
|
void clearM1High();
|
||||||
|
|
||||||
|
NibbleArray createM1High();
|
||||||
|
|
||||||
|
byte[] getM2();
|
||||||
|
|
||||||
|
void setM2(byte[] m2);
|
||||||
|
|
||||||
|
void clearM2();
|
||||||
|
|
||||||
|
byte[] createM2();
|
||||||
}
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.helpers;
|
||||||
|
|
||||||
|
public interface IS1DPacketEntityEffectMixin {
|
||||||
|
int getIDExtended();
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ public final class ShortUtil {
|
|||||||
public static int[] unsignedShortToIntArray(short[] shorts) {
|
public static int[] unsignedShortToIntArray(short[] shorts) {
|
||||||
int[] ints = new int[shorts.length];
|
int[] ints = new int[shorts.length];
|
||||||
|
|
||||||
for(int i = 0; i < shorts.length; ++i) {
|
for (int i = 0; i < shorts.length; ++i) {
|
||||||
ints[i] = unsignedShortToInt(shorts[i]);
|
ints[i] = unsignedShortToInt(shorts[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-7
@@ -1,19 +1,13 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.biomewand;
|
package com.falsepattern.endlessids.mixin.mixins.client.biome.biomewand;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
|
||||||
import com.spacechase0.minecraft.biomewand.BiomeWandMod;
|
|
||||||
import com.spacechase0.minecraft.biomewand.item.BiomeWandItem;
|
import com.spacechase0.minecraft.biomewand.item.BiomeWandItem;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
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 net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagByte;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
|
||||||
|
|
||||||
@Mixin(value = BiomeWandItem.class,
|
@Mixin(value = BiomeWandItem.class,
|
||||||
remap = false)
|
remap = false)
|
||||||
+18
-19
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.client.blockitem.vanilla;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
@@ -18,35 +18,34 @@ import java.io.IOException;
|
|||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Mixin(NetHandlerPlayClient.class)
|
@Mixin(NetHandlerPlayClient.class)
|
||||||
public abstract class NetHandlerPlayClientMixin {
|
public abstract class NetHandlerPlayClientMixin {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private WorldClient clientWorldController;
|
private WorldClient clientWorldController;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author FalsePattern
|
* @author FalsePattern
|
||||||
* @reason Direct port from dumped code
|
* @reason Ported code, TODO figure out a proper mixin for this (difficult)
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) throws IOException {
|
public void handleMultiBlockChange(S22PacketMultiBlockChange packetIn) {
|
||||||
int var2 = packetIn.func_148920_c().chunkXPos * 16;
|
int chunkX = packetIn.func_148920_c().chunkXPos * 16;
|
||||||
int var3 = packetIn.func_148920_c().chunkZPos * 16;
|
int chunkZ = packetIn.func_148920_c().chunkZPos * 16;
|
||||||
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) {
|
try {
|
||||||
short var6 = dataInput.readShort();
|
for (int var5 = 0; var5 < packetIn.func_148922_e(); ++var5) {
|
||||||
short idLSB = dataInput.readShort();
|
short pos = dataInput.readShort();
|
||||||
byte idMSB = dataInput.readByte();
|
short idLSB = dataInput.readShort();
|
||||||
int id = (idLSB & 0xFFFF) | ((idMSB & 0xFF) << 16);
|
byte idMSB = dataInput.readByte();
|
||||||
int var9 = dataInput.readByte() & 15;
|
int id = (idLSB & 0xFFFF) | ((idMSB & 0xFF) << 16);
|
||||||
int var10 = var6 >> 12 & 15;
|
int meta = dataInput.readShort() & 0xFFFF;
|
||||||
int var11 = var6 >> 8 & 15;
|
int x = pos >> 12 & 15;
|
||||||
int var12 = var6 & 255;
|
int z = pos >> 8 & 15;
|
||||||
this.clientWorldController.func_147492_c(var10 + var2, var12, var11 + var3, Block.getBlockById(id),
|
int y = pos & 255;
|
||||||
var9);
|
this.clientWorldController.func_147492_c(x + chunkX, y, z + chunkZ, Block.getBlockById(id), meta);
|
||||||
|
}
|
||||||
|
} catch (IOException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.client.blockitem.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;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.client.blockitem.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;
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.potion.vanilla;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IS1DPacketEntityEffectMixin;
|
||||||
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.client.network.NetHandlerPlayClient;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.network.play.server.S1DPacketEntityEffect;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
@Mixin(NetHandlerPlayClient.class)
|
||||||
|
public abstract class NetHandlerPlayClientMixin {
|
||||||
|
private static int theID;
|
||||||
|
|
||||||
|
@Inject(method = "handleEntityEffect",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
require = 1)
|
||||||
|
private void grabID(S1DPacketEntityEffect packetIn, CallbackInfo ci) {
|
||||||
|
theID = ((IS1DPacketEntityEffectMixin) packetIn).getIDExtended();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "handleEntityEffect",
|
||||||
|
at = @At(value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/entity/EntityLivingBase;addPotionEffect(Lnet/minecraft/potion/PotionEffect;)V"),
|
||||||
|
require = 1)
|
||||||
|
private void addPotionEffect(EntityLivingBase entity, PotionEffect effect) {
|
||||||
|
val newPotion = new PotionEffect(theID, effect.getDuration(), effect.getAmplifier());
|
||||||
|
theID = 0;
|
||||||
|
newPotion.setPotionDurationMax(effect.getIsPotionDurationMax());
|
||||||
|
entity.addPotionEffect(newPotion);
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.redstone;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockRedstoneWire;
|
||||||
|
|
||||||
|
@Mixin(BlockRedstoneWire.class)
|
||||||
|
public abstract class BlockRedstoneWireMixin {
|
||||||
|
@ModifyConstant(method = "randomDisplayTick",
|
||||||
|
constant = @Constant(floatValue = 15.0F),
|
||||||
|
require = 1)
|
||||||
|
private float bigRedstone(float constant) {
|
||||||
|
return GeneralConfig.maxRedstone;
|
||||||
|
}
|
||||||
|
}
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.client.redstone;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.config.GeneralConfig;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
|
|
||||||
|
@Mixin(RenderBlocks.class)
|
||||||
|
public abstract class RenderBlocksMixin {
|
||||||
|
@ModifyConstant(method = "renderBlockRedstoneWire",
|
||||||
|
constant = @Constant(floatValue = 15.0F),
|
||||||
|
require = 1)
|
||||||
|
private float bigRedstone(float constant) {
|
||||||
|
return GeneralConfig.maxRedstone;
|
||||||
|
}
|
||||||
|
}
|
||||||
-147
@@ -1,147 +0,0 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.client.vanilla;
|
|
||||||
|
|
||||||
import com.falsepattern.endlessids.Hooks;
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IExtendedBlockStorageMixin;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
|
||||||
import net.minecraft.world.chunk.NibbleArray;
|
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@SuppressWarnings({"rawtypes", "WhileLoopReplaceableByForEach", "unchecked"})
|
|
||||||
@Mixin(Chunk.class)
|
|
||||||
public abstract class ChunkMixin {
|
|
||||||
@Shadow
|
|
||||||
public Map chunkTileEntityMap;
|
|
||||||
|
|
||||||
@Shadow
|
|
||||||
public World worldObj;
|
|
||||||
@Shadow
|
|
||||||
public boolean isLightPopulated;
|
|
||||||
@Shadow
|
|
||||||
public boolean isTerrainPopulated;
|
|
||||||
@Shadow
|
|
||||||
private ExtendedBlockStorage[] storageArrays;
|
|
||||||
@Shadow
|
|
||||||
private byte[] blockBiomeArray;
|
|
||||||
|
|
||||||
@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
|
|
||||||
* @reason Direct port from dumped code
|
|
||||||
*/
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
@Overwrite
|
|
||||||
public void fillChunk(byte[] var1, int var2, int var3, boolean var4) {
|
|
||||||
Iterator var5 = this.chunkTileEntityMap.values().iterator();
|
|
||||||
|
|
||||||
while (var5.hasNext()) {
|
|
||||||
TileEntity var6 = (TileEntity) var5.next();
|
|
||||||
var6.updateContainingBlockInfo();
|
|
||||||
var6.getBlockMetadata();
|
|
||||||
var6.getBlockType();
|
|
||||||
}
|
|
||||||
|
|
||||||
int var16 = 0;
|
|
||||||
boolean var7 = !this.worldObj.provider.hasNoSky;
|
|
||||||
|
|
||||||
int var8;
|
|
||||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
|
||||||
if ((var2 & 1 << var8) != 0) {
|
|
||||||
if (this.storageArrays[var8] == null) {
|
|
||||||
this.storageArrays[var8] = new ExtendedBlockStorage(var8 << 4, var7);
|
|
||||||
}
|
|
||||||
|
|
||||||
Hooks.setBlockData((IExtendedBlockStorageMixin) this.storageArrays[var8], var1, var16);
|
|
||||||
var16 += 16 * 16 * 16 * ExtendedConstants.bytesPerID;
|
|
||||||
} else if (var4 && this.storageArrays[var8] != null) {
|
|
||||||
this.storageArrays[var8] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NibbleArray var9;
|
|
||||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
|
||||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
|
||||||
var9 = this.storageArrays[var8].getMetadataArray();
|
|
||||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
|
||||||
var16 += var9.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
|
||||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
|
||||||
var9 = this.storageArrays[var8].getBlocklightArray();
|
|
||||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
|
||||||
var16 += var9.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var7) {
|
|
||||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
|
||||||
if ((var2 & 1 << var8) != 0 && this.storageArrays[var8] != null) {
|
|
||||||
var9 = this.storageArrays[var8].getSkylightArray();
|
|
||||||
System.arraycopy(var1, var16, var9.data, 0, var9.data.length);
|
|
||||||
var16 += var9.data.length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var4) {
|
|
||||||
var16 += Hooks.readBiomeArrayFromPacket((Chunk) (Object) this, var1, var16);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var8 = 0; var8 < this.storageArrays.length; ++var8) {
|
|
||||||
if (this.storageArrays[var8] != null && (var2 & 1 << var8) != 0) {
|
|
||||||
this.storageArrays[var8].removeInvalidBlocks();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isLightPopulated = true;
|
|
||||||
this.isTerrainPopulated = true;
|
|
||||||
this.generateHeightMap();
|
|
||||||
ArrayList var10 = new ArrayList();
|
|
||||||
|
|
||||||
TileEntity var11;
|
|
||||||
for (var5 = this.chunkTileEntityMap.values().iterator(); var5.hasNext(); var11.updateContainingBlockInfo()) {
|
|
||||||
var11 = (TileEntity) var5.next();
|
|
||||||
int var12 = var11.xCoord & 15;
|
|
||||||
int var13 = var11.yCoord;
|
|
||||||
int var14 = var11.zCoord & 15;
|
|
||||||
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)) {
|
|
||||||
var10.add(var11);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator var17 = var10.iterator();
|
|
||||||
|
|
||||||
while (var17.hasNext()) {
|
|
||||||
TileEntity var18 = (TileEntity) var17.next();
|
|
||||||
var18.invalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-2
@@ -56,8 +56,7 @@ public abstract class BiomesManagerMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
|
@ModifyConstant(method = {"preinit", "setUpBiomesFolder"},
|
||||||
constant = {@Constant(stringValue = "\\biomes"),
|
constant = {@Constant(stringValue = "\\biomes"), @Constant(stringValue = "\\main.cfg")})
|
||||||
@Constant(stringValue = "\\main.cfg")})
|
|
||||||
private static String fixPaths(String original) {
|
private static String fixPaths(String original) {
|
||||||
return AIDCStringFixer.fixString(original);
|
return AIDCStringFixer.fixString(original);
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-20
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.abyssalcraft;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.abyssalcraft;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
@@ -44,25 +44,6 @@ public abstract class AbyssalCraftMixin {
|
|||||||
@Shadow
|
@Shadow
|
||||||
public static int configBiomeId13;
|
public static int configBiomeId13;
|
||||||
|
|
||||||
@Inject(method = "checkBiomeIds",
|
|
||||||
at = @At("HEAD"),
|
|
||||||
require = 1)
|
|
||||||
private void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
|
||||||
val bga = BiomeGenBase.getBiomeGenArray();
|
|
||||||
|
|
||||||
int[] biomes = new int[]{configBiomeId1, configBiomeId2, configBiomeId3, configBiomeId4, configBiomeId5,
|
|
||||||
configBiomeId6, configBiomeId7, configBiomeId8, configBiomeId9, configBiomeId10,
|
|
||||||
configBiomeId11, configBiomeId12, configBiomeId13};
|
|
||||||
for (val biome : biomes) {
|
|
||||||
if (biome < 0 || biome >= ExtendedConstants.biomeIDCount) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (bga[biome] instanceof PlaceholderBiome) {
|
|
||||||
bga[biome] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyConstant(method = "syncConfig",
|
@ModifyConstant(method = "syncConfig",
|
||||||
constant = {@Constant(intValue = 100, ordinal = 0),
|
constant = {@Constant(intValue = 100, ordinal = 0),
|
||||||
@Constant(intValue = 101, ordinal = 0),
|
@Constant(intValue = 101, ordinal = 0),
|
||||||
@@ -81,4 +62,23 @@ public abstract class AbyssalCraftMixin {
|
|||||||
private static int shiftBiomeIDsUp(int constant) {
|
private static int shiftBiomeIDsUp(int constant) {
|
||||||
return constant + 8000;
|
return constant + 8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "checkBiomeIds",
|
||||||
|
at = @At("HEAD"),
|
||||||
|
require = 1)
|
||||||
|
private void cleanupBiomeArrayForAssignment(CallbackInfo ci) {
|
||||||
|
val bga = BiomeGenBase.getBiomeGenArray();
|
||||||
|
|
||||||
|
int[] biomes = new int[]{configBiomeId1, configBiomeId2, configBiomeId3, configBiomeId4, configBiomeId5,
|
||||||
|
configBiomeId6, configBiomeId7, configBiomeId8, configBiomeId9, configBiomeId10,
|
||||||
|
configBiomeId11, configBiomeId12, configBiomeId13};
|
||||||
|
for (val biome : biomes) {
|
||||||
|
if (biome < 0 || biome >= ExtendedConstants.biomeIDCount) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (bga[biome] instanceof PlaceholderBiome) {
|
||||||
|
bga[biome] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.antiqueatlas;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
@@ -16,6 +16,8 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
@Mixin(value = BiomeDetectorBase.class,
|
@Mixin(value = BiomeDetectorBase.class,
|
||||||
remap = false)
|
remap = false)
|
||||||
public abstract class BiomeDetectorBaseMixin {
|
public abstract class BiomeDetectorBaseMixin {
|
||||||
|
private Chunk chunk;
|
||||||
|
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
require = 2)
|
require = 2)
|
||||||
@@ -23,8 +25,6 @@ public abstract class BiomeDetectorBaseMixin {
|
|||||||
return ExtendedConstants.biomeIDCount;
|
return ExtendedConstants.biomeIDCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Chunk chunk;
|
|
||||||
|
|
||||||
@Redirect(method = "getBiomeID",
|
@Redirect(method = "getBiomeID",
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
@@ -41,7 +41,7 @@ public abstract class BiomeDetectorBaseMixin {
|
|||||||
require = 1)
|
require = 1)
|
||||||
private int[] biomeIDs(byte[] i) {
|
private int[] biomeIDs(byte[] i) {
|
||||||
try {
|
try {
|
||||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
return ShortUtil.unsignedShortToIntArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||||
} finally {
|
} finally {
|
||||||
chunk = null;
|
chunk = null;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.antiqueatlas;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.antiqueatlas;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
import com.falsepattern.endlessids.mixin.helpers.ShortUtil;
|
||||||
@@ -30,7 +30,7 @@ public abstract class BiomeDetectorNetherMixin {
|
|||||||
require = 1)
|
require = 1)
|
||||||
private int[] biomeIDs(byte[] i) {
|
private int[] biomeIDs(byte[] i) {
|
||||||
try {
|
try {
|
||||||
return ShortUtil.unsignedShortToIntArray(((IChunkMixin)chunk).getBiomeShortArray());
|
return ShortUtil.unsignedShortToIntArray(((IChunkMixin) chunk).getBiomeShortArray());
|
||||||
} finally {
|
} finally {
|
||||||
chunk = null;
|
chunk = null;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.arocketry;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.arocketry;
|
||||||
|
|
||||||
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;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.arocketry;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.arocketry;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.atg;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.atg;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.atg;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.atg;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+9
-9
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.biometweaker;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.biometweaker;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
@@ -30,14 +30,6 @@ public abstract class BiomeEventHandlerMixin {
|
|||||||
return ExtendedConstants.biomeIDCount;
|
return ExtendedConstants.biomeIDCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "<init>",
|
|
||||||
at = @At("RETURN"),
|
|
||||||
require = 1)
|
|
||||||
private void extendIDs2(CallbackInfo ci) {
|
|
||||||
colorCache = new int[ExtendedConstants.biomeIDCount * 3];
|
|
||||||
Arrays.fill(colorCache, -2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ModifyConstant(method = "onGetFoliageColor",
|
@ModifyConstant(method = "onGetFoliageColor",
|
||||||
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
constant = @Constant(intValue = VanillaConstants.biomeIDCount),
|
||||||
require = 1)
|
require = 1)
|
||||||
@@ -51,4 +43,12 @@ public abstract class BiomeEventHandlerMixin {
|
|||||||
private static int extendIDs4(int constant) {
|
private static int extendIDs4(int constant) {
|
||||||
return ExtendedConstants.biomeIDCount * 2;
|
return ExtendedConstants.biomeIDCount * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "<init>",
|
||||||
|
at = @At("RETURN"),
|
||||||
|
require = 1)
|
||||||
|
private void extendIDs2(CallbackInfo ci) {
|
||||||
|
colorCache = new int[ExtendedConstants.biomeIDCount * 3];
|
||||||
|
Arrays.fill(colorCache, -2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+7
-7
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.biomewand;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.biomewand;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
@@ -42,17 +42,17 @@ public abstract class BiomeWandItemMixin {
|
|||||||
int relBlockX = blockX & 15;
|
int relBlockX = blockX & 15;
|
||||||
int relBlockZ = blockZ & 15;
|
int relBlockZ = blockZ & 15;
|
||||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||||
short biome = ((IChunkMixin)chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
short biome = ((IChunkMixin) chunk).getBiomeShortArray()[relBlockZ * 16 + relBlockX];
|
||||||
tag.setShort("sampledBiomeS", biome);
|
tag.setShort("sampledBiomeS", biome);
|
||||||
} else {
|
} else {
|
||||||
short biome = tag.getShort("sampledBiomeS");
|
short biome = tag.getShort("sampledBiomeS");
|
||||||
|
|
||||||
for(int ix = blockX - 3; ix <= blockX + 3; ++ix) {
|
for (int ix = blockX - 3; ix <= blockX + 3; ++ix) {
|
||||||
for(int iz = blockZ - 3; iz <= blockZ + 3; ++iz) {
|
for (int iz = blockZ - 3; iz <= blockZ + 3; ++iz) {
|
||||||
int relBlockX = ix & 15;
|
int relBlockX = ix & 15;
|
||||||
int relBlockZ = iz & 15;
|
int relBlockZ = iz & 15;
|
||||||
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
Chunk chunk = world.getChunkFromBlockCoords(blockX, blockZ);
|
||||||
((IChunkMixin)chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
((IChunkMixin) chunk).getBiomeShortArray()[relBlockZ << 4 | relBlockX] = biome;
|
||||||
chunk.isModified = true;
|
chunk.isModified = true;
|
||||||
BiomeWandMod.proxy.updateRendererAt(ix, iz);
|
BiomeWandMod.proxy.updateRendererAt(ix, iz);
|
||||||
}
|
}
|
||||||
@@ -96,12 +96,12 @@ public abstract class BiomeWandItemMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
public void getSubItems(Item item, CreativeTabs tabs, List list) {
|
||||||
list.add(new ItemStack((BiomeWandItem)(Object)this, 1));
|
list.add(new ItemStack((BiomeWandItem) (Object) this, 1));
|
||||||
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
|
||||||
if (biome != null && !(biome instanceof PlaceholderBiome)) {
|
if (biome != null && !(biome instanceof PlaceholderBiome)) {
|
||||||
NBTTagCompound compound = new NBTTagCompound();
|
NBTTagCompound compound = new NBTTagCompound();
|
||||||
compound.setShort("sampledBiomeS", (short) biome.biomeID);
|
compound.setShort("sampledBiomeS", (short) biome.biomeID);
|
||||||
ItemStack wand = new ItemStack((BiomeWandItem)(Object)this, 1);
|
ItemStack wand = new ItemStack((BiomeWandItem) (Object) this, 1);
|
||||||
wand.setTagCompound(compound);
|
wand.setTagCompound(compound);
|
||||||
list.add(wand);
|
list.add(wand);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.bop;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.bop;
|
||||||
|
|
||||||
import biomesoplenty.common.world.BOPBiomeManager;
|
import biomesoplenty.common.world.BOPBiomeManager;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.bop;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.bop;
|
||||||
|
|
||||||
import biomesoplenty.common.core.BOPBiomes;
|
import biomesoplenty.common.core.BOPBiomes;
|
||||||
import biomesoplenty.common.world.BOPBiomeManager;
|
import biomesoplenty.common.world.BOPBiomeManager;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.buildcraft;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.buildcraft;
|
||||||
|
|
||||||
import buildcraft.BuildCraftEnergy;
|
import buildcraft.BuildCraftEnergy;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
+11
-9
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.compactmachines;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.compactmachines;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import com.falsepattern.endlessids.mixin.stubpackage.org.dave.CompactMachines.tileentity.TileEntityMachine;
|
import com.falsepattern.endlessids.mixin.stubpackage.org.dave.CompactMachines.tileentity.TileEntityMachine;
|
||||||
@@ -27,10 +27,10 @@ public abstract class CubeToolsMixin {
|
|||||||
WorldServer machineWorld = MinecraftServer.getServer().worldServerForDimension(ConfigurationHandler.dimensionId);
|
WorldServer machineWorld = MinecraftServer.getServer().worldServerForDimension(ConfigurationHandler.dimensionId);
|
||||||
Chunk chunk = machineWorld.getChunkFromBlockCoords(coords * ConfigurationHandler.cubeDistance, 0);
|
Chunk chunk = machineWorld.getChunkFromBlockCoords(coords * ConfigurationHandler.cubeDistance, 0);
|
||||||
if (chunk != null && chunk.isChunkLoaded) {
|
if (chunk != null && chunk.isChunkLoaded) {
|
||||||
short[] biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
short[] biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
for(int x = 0; x < 15; ++x) {
|
for (int x = 0; x < 15; ++x) {
|
||||||
for(int z = 0; z < 15; ++z) {
|
for (int z = 0; z < 15; ++z) {
|
||||||
biomeArray[z << 4 | x] = (short)biome.biomeID;
|
biomeArray[z << 4 | x] = (short) biome.biomeID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,10 +43,12 @@ public abstract class CubeToolsMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static BiomeGenBase getMachineBiome(TileEntityMachine machine) {
|
public static BiomeGenBase getMachineBiome(TileEntityMachine machine) {
|
||||||
short[] biomeArray = ((IChunkMixin)machine.getWorldObj().getChunkFromBlockCoords(machine.xCoord, machine.zCoord)).getBiomeShortArray();
|
short[] biomeArray = ((IChunkMixin) machine.getWorldObj()
|
||||||
|
.getChunkFromBlockCoords(machine.xCoord,
|
||||||
|
machine.zCoord)).getBiomeShortArray();
|
||||||
int biomeId = biomeArray[(machine.zCoord & 15) << 4 | machine.xCoord & 15];
|
int biomeId = biomeArray[(machine.zCoord & 15) << 4 | machine.xCoord & 15];
|
||||||
return biomeId > 0 && biomeId < BiomeGenBase.getBiomeGenArray().length && BiomeDictionary.isBiomeRegistered(biomeId)
|
return biomeId > 0 && biomeId < BiomeGenBase.getBiomeGenArray().length &&
|
||||||
? BiomeGenBase.getBiome(biomeId)
|
BiomeDictionary.isBiomeRegistered(biomeId) ? BiomeGenBase.getBiome(biomeId) : WorldUtils.getBiomeByName(
|
||||||
: WorldUtils.getBiomeByName(ConfigurationHandler.defaultBiome);
|
ConfigurationHandler.defaultBiome);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.darkworld;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.darkworld;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.config.DarkWorldIDConfig;
|
import com.falsepattern.endlessids.config.DarkWorldIDConfig;
|
||||||
import matthbo.mods.darkworld.init.ModBiomes;
|
import matthbo.mods.darkworld.init.ModBiomes;
|
||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.dimdoors;
|
||||||
|
|
||||||
|
import StevenDimDoors.mod_pocketDim.world.DDBiomeGenBase;
|
||||||
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
|
import lombok.val;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
|
||||||
|
@Mixin(value = DDBiomeGenBase.class,
|
||||||
|
priority = 999,
|
||||||
|
remap = false)
|
||||||
|
public abstract class DDBiomeGenBaseMixin extends BiomeGenBase {
|
||||||
|
private DDBiomeGenBaseMixin(int p_i1971_1_) {
|
||||||
|
super(p_i1971_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Compat patch
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
public static void checkBiomes(int[] biomes) {
|
||||||
|
val arr = getBiomeGenArray();
|
||||||
|
for(int k = 0; k < biomes.length; ++k) {
|
||||||
|
val b = arr[biomes[k]];
|
||||||
|
if (b != null && !(b instanceof DDBiomeGenBase || b instanceof PlaceholderBiome)) {
|
||||||
|
throw new IllegalStateException("There is a biome ID conflict between a biome from Dimensional Doors and another biome type. Fix your configuration!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.dragonapi;
|
||||||
|
|
||||||
import Reika.DragonAPI.Instantiable.Event.GenLayerRiverEvent;
|
import Reika.DragonAPI.Instantiable.Event.GenLayerRiverEvent;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.dragonapi;
|
||||||
|
|
||||||
import Reika.DragonAPI.Libraries.World.ReikaChunkHelper;
|
import Reika.DragonAPI.Libraries.World.ReikaChunkHelper;
|
||||||
import com.falsepattern.endlessids.EndlessIDs;
|
import com.falsepattern.endlessids.EndlessIDs;
|
||||||
@@ -13,13 +13,14 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
remap = false)
|
remap = false)
|
||||||
public abstract class ReikaChunkHelperMixin {
|
public abstract class ReikaChunkHelperMixin {
|
||||||
private static short[] biomeArray;
|
private static short[] biomeArray;
|
||||||
|
|
||||||
@Redirect(method = "copyChunk",
|
@Redirect(method = "copyChunk",
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
target = "Lnet/minecraft/world/chunk/Chunk;setBiomeArray([B)V",
|
||||||
remap = true),
|
remap = true),
|
||||||
require = 1)
|
require = 1)
|
||||||
private static void customSet(Chunk chunk, byte[] p_76616_1_) {
|
private static void customSet(Chunk chunk, byte[] p_76616_1_) {
|
||||||
((IChunkMixin)chunk).setBiomeShortArray(biomeArray);
|
((IChunkMixin) chunk).setBiomeShortArray(biomeArray);
|
||||||
biomeArray = null;
|
biomeArray = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ public abstract class ReikaChunkHelperMixin {
|
|||||||
remap = true),
|
remap = true),
|
||||||
require = 1)
|
require = 1)
|
||||||
private static byte[] customGet(Chunk chunk) {
|
private static byte[] customGet(Chunk chunk) {
|
||||||
biomeArray = ((IChunkMixin)chunk).getBiomeShortArray();
|
biomeArray = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
return EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
return EndlessIDs.ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+9
-9
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.dragonapi;
|
||||||
|
|
||||||
import Reika.DragonAPI.Libraries.World.ReikaWorldHelper;
|
import Reika.DragonAPI.Libraries.World.ReikaWorldHelper;
|
||||||
import com.falsepattern.endlessids.EndlessIDs;
|
import com.falsepattern.endlessids.EndlessIDs;
|
||||||
@@ -18,6 +18,8 @@ import net.minecraft.world.chunk.Chunk;
|
|||||||
@Mixin(value = ReikaWorldHelper.class,
|
@Mixin(value = ReikaWorldHelper.class,
|
||||||
remap = false)
|
remap = false)
|
||||||
public abstract class ReikaWorldHelperMixin {
|
public abstract class ReikaWorldHelperMixin {
|
||||||
|
private static int fromBiomeID;
|
||||||
|
|
||||||
@Redirect(method = {"setBiomeForXZ", "setBiomeAndBlocksForXZ"},
|
@Redirect(method = {"setBiomeForXZ", "setBiomeAndBlocksForXZ"},
|
||||||
at = @At(value = "INVOKE",
|
at = @At(value = "INVOKE",
|
||||||
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
target = "Lnet/minecraft/world/chunk/Chunk;getBiomeArray()[B",
|
||||||
@@ -42,20 +44,18 @@ public abstract class ReikaWorldHelperMixin {
|
|||||||
remap = true),
|
remap = true),
|
||||||
locals = LocalCapture.CAPTURE_FAILHARD,
|
locals = LocalCapture.CAPTURE_FAILHARD,
|
||||||
require = 1)
|
require = 1)
|
||||||
private static void customLogicSetBiome(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
private static void customLogicSetBiome(World world, int x, int z, BiomeGenBase biome, boolean applyEnvironment, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||||
((IChunkMixin)ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
((IChunkMixin) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int fromBiomeID;
|
|
||||||
|
|
||||||
@Inject(method = "setBiomeAndBlocksForXZ",
|
@Inject(method = "setBiomeAndBlocksForXZ",
|
||||||
at = @At(value = "FIELD",
|
at = @At(value = "FIELD",
|
||||||
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeList:[Lnet/minecraft/world/biome/BiomeGenBase;",
|
target = "Lnet/minecraft/world/biome/BiomeGenBase;biomeList:[Lnet/minecraft/world/biome/BiomeGenBase;",
|
||||||
remap = true),
|
remap = true),
|
||||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||||
require = 1)
|
require = 1)
|
||||||
private static void captureIndexSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
private static void captureIndexSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, boolean applyEnvironment, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index) {
|
||||||
fromBiomeID = ((IChunkMixin)ch).getBiomeShortArray()[index];
|
fromBiomeID = ((IChunkMixin) ch).getBiomeShortArray()[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyVariable(method = "setBiomeAndBlocksForXZ",
|
@ModifyVariable(method = "setBiomeAndBlocksForXZ",
|
||||||
@@ -71,7 +71,7 @@ public abstract class ReikaWorldHelperMixin {
|
|||||||
remap = true),
|
remap = true),
|
||||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||||
require = 1)
|
require = 1)
|
||||||
private static void customLogicSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index, BiomeGenBase from) {
|
private static void customLogicSetBiomeAndBlocks(World world, int x, int z, BiomeGenBase biome, boolean applyEnvironment, CallbackInfo ci, Chunk ch, int ax, int az, byte[] biomes, int index, BiomeGenBase from) {
|
||||||
((IChunkMixin)ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
((IChunkMixin) ch).getBiomeShortArray()[index] = (short) biome.biomeID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.dragonapi.vanilla;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.dragonapi.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;
|
||||||
+3
-2
@@ -1,11 +1,12 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.eb;
|
||||||
|
|
||||||
import enhancedbiomes.world.biomestats.BiomeIDs;
|
import enhancedbiomes.world.biomestats.BiomeIDs;
|
||||||
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;
|
||||||
|
|
||||||
@Mixin(BiomeIDs.class)
|
@Mixin(value = BiomeIDs.class,
|
||||||
|
remap = false)
|
||||||
public abstract class BiomeIDsMixin {
|
public abstract class BiomeIDsMixin {
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
constant = @Constant(intValue = 39),
|
constant = @Constant(intValue = 39),
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.eb;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.eb;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.eb;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.eb;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.eb;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
+2
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.enderlicious;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.enderlicious;
|
||||||
|
|
||||||
import DelirusCrux.Enderlicious.Common.Utility.Configuration.BiomeConfiguration;
|
import DelirusCrux.Enderlicious.Common.Utility.Configuration.BiomeConfiguration;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -9,8 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
|||||||
remap = false)
|
remap = false)
|
||||||
public abstract class BiomeConfigurationMixin {
|
public abstract class BiomeConfigurationMixin {
|
||||||
@ModifyConstant(method = "init",
|
@ModifyConstant(method = "init",
|
||||||
constant = {@Constant(intValue = 200),
|
constant = {@Constant(intValue = 200), @Constant(intValue = 210)},
|
||||||
@Constant(intValue = 210)},
|
|
||||||
require = 2)
|
require = 2)
|
||||||
private static int shiftBiomeIDsUp(int id) {
|
private static int shiftBiomeIDsUp(int id) {
|
||||||
return id + 3000;
|
return id + 3000;
|
||||||
+3
-4
@@ -1,7 +1,6 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.enderlicious;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.enderlicious;
|
||||||
|
|
||||||
import DelirusCrux.Enderlicious.Dimension.EndChunkProvider;
|
import DelirusCrux.Enderlicious.Dimension.EndChunkProvider;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -41,11 +40,11 @@ public abstract class EndChunkProviderMixin {
|
|||||||
require = 1)
|
require = 1)
|
||||||
private byte[] setBiomesTweaked(Chunk chunk) {
|
private byte[] setBiomesTweaked(Chunk chunk) {
|
||||||
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
val chunkBiomes = ((IChunkMixin) chunk).getBiomeShortArray();
|
||||||
for(int k = 0; k < chunkBiomes.length; ++k) {
|
for (int k = 0; k < chunkBiomes.length; ++k) {
|
||||||
if (Math.abs(xx) < 160 && Math.abs(zz) < 160) {
|
if (Math.abs(xx) < 160 && Math.abs(zz) < 160) {
|
||||||
chunkBiomes[k] = 9;
|
chunkBiomes[k] = 9;
|
||||||
} else {
|
} else {
|
||||||
chunkBiomes[k] = (short)this.biomesForGeneration[k].biomeID;
|
chunkBiomes[k] = (short) this.biomesForGeneration[k].biomeID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
return ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER;
|
||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.erebus;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.erebus;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
@@ -10,7 +10,6 @@ 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.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
@@ -72,7 +71,8 @@ public abstract class ModBiomesMixin {
|
|||||||
constant = @Constant(stringValue = "Erebus biome IDs cannot be higher than 127 or smaller than 0!"),
|
constant = @Constant(stringValue = "Erebus biome IDs cannot be higher than 127 or smaller than 0!"),
|
||||||
require = 1)
|
require = 1)
|
||||||
private static String modifyWarning(String str) {
|
private static String modifyWarning(String str) {
|
||||||
return "Erebus biome IDs cannot be higher than " + (ExtendedConstants.biomeIDCount - 129) + " or smaller than 0!";
|
return "Erebus biome IDs cannot be higher than " + (ExtendedConstants.biomeIDCount - 129) +
|
||||||
|
" or smaller than 0!";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "init",
|
@Inject(method = "init",
|
||||||
@@ -85,7 +85,7 @@ public abstract class ModBiomesMixin {
|
|||||||
ulteriorOutbackID, fungalForestID, submergedSwampID, fieldsSubForestID,
|
ulteriorOutbackID, fungalForestID, submergedSwampID, fieldsSubForestID,
|
||||||
jungleSubLakeID, jungleSubAsperGroveID, desertSubCharredForestID,
|
jungleSubLakeID, jungleSubAsperGroveID, desertSubCharredForestID,
|
||||||
savannahSubRockyWastelandID, savannahSubAsperGroveID, savannahSubSteppeID};
|
savannahSubRockyWastelandID, savannahSubAsperGroveID, savannahSubSteppeID};
|
||||||
for (val biome: biomes) {
|
for (val biome : biomes) {
|
||||||
if (biome <= 0 || biome >= ExtendedConstants.biomeIDCount - 129) {
|
if (biome <= 0 || biome >= ExtendedConstants.biomeIDCount - 129) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.extraplanets;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.extraplanets;
|
||||||
|
|
||||||
import com.mjr.extraplanets.Config;
|
import com.mjr.extraplanets.Config;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.extrautilities;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.extrautilities;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.EndlessIDs;
|
import com.falsepattern.endlessids.EndlessIDs;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
+3
-2
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.futurepack;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.futurepack;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.config.FuturepackIDConfig;
|
import com.falsepattern.endlessids.config.FuturepackIDConfig;
|
||||||
import futurepack.common.dim.BiomeGenSpace;
|
import futurepack.common.dim.BiomeGenSpace;
|
||||||
@@ -6,7 +6,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(BiomeGenSpace.class)
|
@Mixin(value = BiomeGenSpace.class,
|
||||||
|
remap = false)
|
||||||
public abstract class BiomeGenSpaceMixin {
|
public abstract class BiomeGenSpaceMixin {
|
||||||
@ModifyConstant(method = "<clinit>",
|
@ModifyConstant(method = "<clinit>",
|
||||||
constant = @Constant(intValue = 97),
|
constant = @Constant(intValue = 97),
|
||||||
+1
-4
@@ -1,15 +1,12 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.galacticraft;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.galacticraft;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
import futurepack.common.dim.ChunkProviderSpace;
|
|
||||||
import micdoodle8.mods.galacticraft.core.world.gen.BiomeGenBaseOrbit;
|
import micdoodle8.mods.galacticraft.core.world.gen.BiomeGenBaseOrbit;
|
||||||
import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderOrbit;
|
import micdoodle8.mods.galacticraft.core.world.gen.ChunkProviderOrbit;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
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.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
import net.minecraft.world.biome.BiomeGenBase;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
@Mixin(value = ChunkProviderOrbit.class,
|
@Mixin(value = ChunkProviderOrbit.class,
|
||||||
+2
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.galacticraft;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.galacticraft;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
@@ -16,6 +16,7 @@ public abstract class ConfigManagerCoreMixin {
|
|||||||
private static int shiftBiomeIDsUp(int id) {
|
private static int shiftBiomeIDsUp(int id) {
|
||||||
return id + 18000;
|
return id + 18000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ModifyConstant(method = "syncConfig",
|
@ModifyConstant(method = "syncConfig",
|
||||||
constant = @Constant(stringValue = "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."),
|
constant = @Constant(stringValue = "Biome ID for Moon (Mars will be this + 1, Asteroids + 2 etc). Allowed range 40-250."),
|
||||||
require = 1)
|
require = 1)
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.galaxyspace;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.galaxyspace;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.GalaxySpaceHelper;
|
import com.falsepattern.endlessids.mixin.helpers.GalaxySpaceHelper;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.galaxyspace;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.galaxyspace;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.GalaxySpaceHelper;
|
import com.falsepattern.endlessids.mixin.helpers.GalaxySpaceHelper;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.galaxyspace;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.galaxyspace;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.galaxyspace;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.galaxyspace;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
import com.falsepattern.endlessids.mixin.helpers.BiomePatchHelper;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.GalaxySpaceHelper;
|
import com.falsepattern.endlessids.mixin.helpers.GalaxySpaceHelper;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.highlands;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.highlands;
|
||||||
|
|
||||||
import highlands.Config;
|
import highlands.Config;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.icg;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.icg;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
import com.falsepattern.endlessids.constants.ExtendedConstants;
|
||||||
import com.falsepattern.endlessids.constants.VanillaConstants;
|
import com.falsepattern.endlessids.constants.VanillaConstants;
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.ir3;
|
||||||
|
|
||||||
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
|
import jp.plusplus.ir2.IR2;
|
||||||
|
import jp.plusplus.ir2.blocks.BlockCore;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.world.biome.BiomeGenBase;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
import net.minecraftforge.event.terraingen.OreGenEvent;
|
||||||
|
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
|
@Mixin(value = IR2.class,
|
||||||
|
priority = 999,
|
||||||
|
remap = false)
|
||||||
|
public abstract class IR2Mixin {
|
||||||
|
@Shadow public static boolean oresAreGenerated;
|
||||||
|
|
||||||
|
@Shadow public static boolean generateTinOre;
|
||||||
|
|
||||||
|
@Shadow public static boolean generateCopperOre;
|
||||||
|
|
||||||
|
@Shadow public static boolean generateSilverOre;
|
||||||
|
|
||||||
|
@Shadow public static boolean generateManganeseCrust;
|
||||||
|
|
||||||
|
@Shadow public static boolean generateCobaltCrust;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author FalsePattern
|
||||||
|
* @reason Compat
|
||||||
|
*/
|
||||||
|
@SubscribeEvent
|
||||||
|
@Overwrite
|
||||||
|
public void generateOrePre(OreGenEvent.Pre event) {
|
||||||
|
if (oresAreGenerated) {
|
||||||
|
WorldGenerator genTin = new WorldGenMinable(BlockCore.ore, 0, 8, Blocks.stone);
|
||||||
|
WorldGenerator genCopper = new WorldGenMinable(BlockCore.ore, 1, 8, Blocks.stone);
|
||||||
|
WorldGenerator genSilver = new WorldGenMinable(BlockCore.ore, 2, 8, Blocks.stone);
|
||||||
|
WorldGenerator genManganese = new WorldGenMinable(BlockCore.crust, 0, 16, Blocks.gravel);
|
||||||
|
WorldGenerator genCobalt = new WorldGenMinable(BlockCore.crust, 1, 16, Blocks.gravel);
|
||||||
|
if (generateTinOre && TerrainGen.generateOre(event.world, event.rand, genTin, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||||
|
for(int i = 0; i < 14; ++i) {
|
||||||
|
genTin.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 30 + event.rand.nextInt(20), event.worldZ + event.rand.nextInt(16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (generateCopperOre && TerrainGen.generateOre(event.world, event.rand, genCopper, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||||
|
for(int i = 0; i < 10; ++i) {
|
||||||
|
genCopper.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 20 + event.rand.nextInt(20), event.worldZ + event.rand.nextInt(16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (generateSilverOre && TerrainGen.generateOre(event.world, event.rand, genSilver, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||||
|
for(int i = 0; i < 4; ++i) {
|
||||||
|
genSilver.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 1 + event.rand.nextInt(29), event.worldZ + event.rand.nextInt(16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
short[] bIds = ((IChunkMixin)event.world.getChunkFromBlockCoords(event.worldX, event.worldZ)).getBiomeShortArray();
|
||||||
|
|
||||||
|
for(int k = 0; k < bIds.length; ++k) {
|
||||||
|
if (bIds[k] == BiomeGenBase.ocean.biomeID || bIds[k] == BiomeGenBase.deepOcean.biomeID) {
|
||||||
|
if (generateManganeseCrust && TerrainGen.generateOre(event.world, event.rand, genSilver, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||||
|
for(int i = 0; i < 7; ++i) {
|
||||||
|
genManganese.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 16 + event.rand.nextInt(48), event.worldZ + event.rand.nextInt(16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (generateCobaltCrust && TerrainGen.generateOre(event.world, event.rand, genSilver, event.worldX, event.worldZ, OreGenEvent.GenerateMinable.EventType.CUSTOM)) {
|
||||||
|
for(int i = 0; i < 7; ++i) {
|
||||||
|
genCobalt.generate(event.world, event.rand, event.worldX + event.rand.nextInt(16), 16 + event.rand.nextInt(48), event.worldZ + event.rand.nextInt(16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.lotr;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||||
import lotr.common.world.biome.variant.LOTRBiomeVariantStorage;
|
import lotr.common.world.biome.variant.LOTRBiomeVariantStorage;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.lotr;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||||
import lotr.common.world.LOTRChunkProvider;
|
import lotr.common.world.LOTRChunkProvider;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.lotr;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||||
import lotr.common.world.LOTRChunkProviderUtumno;
|
import lotr.common.world.LOTRChunkProviderUtumno;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.lotr;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.Hooks;
|
import com.falsepattern.endlessids.Hooks;
|
||||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.lotr;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.lotr;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
import com.falsepattern.endlessids.mixin.helpers.LOTRBiomeVariantStorageShort;
|
||||||
import lotr.common.world.LOTRWorldChunkManager;
|
import lotr.common.world.LOTRWorldChunkManager;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.naturescompass;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.naturescompass;
|
||||||
|
|
||||||
import com.chaosthedude.naturescompass.util.BiomeUtils;
|
import com.chaosthedude.naturescompass.util.BiomeUtils;
|
||||||
import com.falsepattern.endlessids.PlaceholderBiome;
|
import com.falsepattern.endlessids.PlaceholderBiome;
|
||||||
+2
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.netherlicious;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.netherlicious;
|
||||||
|
|
||||||
import DelirusCrux.Netherlicious.Utility.Configuration.BiomeConfiguration;
|
import DelirusCrux.Netherlicious.Utility.Configuration.BiomeConfiguration;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@@ -9,8 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
|||||||
remap = false)
|
remap = false)
|
||||||
public abstract class BiomeConfigurationMixin {
|
public abstract class BiomeConfigurationMixin {
|
||||||
@ModifyConstant(method = "init",
|
@ModifyConstant(method = "init",
|
||||||
constant = {@Constant(intValue = 170),
|
constant = {@Constant(intValue = 170), @Constant(intValue = 175)},
|
||||||
@Constant(intValue = 175)},
|
|
||||||
require = 2)
|
require = 2)
|
||||||
private static int shiftBiomeIDsUp(int id) {
|
private static int shiftBiomeIDsUp(int id) {
|
||||||
return id + 3000;
|
return id + 3000;
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.nomadictents;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.nomadictents;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import com.yurtmod.dimension.TentChunkProvider;
|
import com.yurtmod.dimension.TentChunkProvider;
|
||||||
@@ -22,7 +22,7 @@ public abstract class TentChunkProviderMixin {
|
|||||||
require = 1)
|
require = 1)
|
||||||
private void setBiomesTweaked(Chunk chunk, byte[] p_76616_1_) {
|
private void setBiomesTweaked(Chunk chunk, byte[] p_76616_1_) {
|
||||||
short[] biomeMap = new short[256];
|
short[] biomeMap = new short[256];
|
||||||
Arrays.fill(biomeMap, (short)BiomeGenBase.ocean.biomeID);
|
Arrays.fill(biomeMap, (short) BiomeGenBase.ocean.biomeID);
|
||||||
((IChunkMixin)chunk).setBiomeShortArray(biomeMap);
|
((IChunkMixin) chunk).setBiomeShortArray(biomeMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-6
@@ -1,4 +1,4 @@
|
|||||||
package com.falsepattern.endlessids.mixin.mixins.common.randomthings;
|
package com.falsepattern.endlessids.mixin.mixins.common.biome.randomthings;
|
||||||
|
|
||||||
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
import com.falsepattern.endlessids.mixin.helpers.IChunkMixin;
|
||||||
import lumien.randomthings.Items.ItemBiomeCapsule;
|
import lumien.randomthings.Items.ItemBiomeCapsule;
|
||||||
@@ -28,7 +28,7 @@ public abstract class ItemBiomePainterMixin {
|
|||||||
} else if (par3World.isRemote) {
|
} else if (par3World.isRemote) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
for(int i = 0; i < par2EntityPlayer.inventory.getSizeInventory(); ++i) {
|
for (int i = 0; i < par2EntityPlayer.inventory.getSizeInventory(); ++i) {
|
||||||
ItemStack is = par2EntityPlayer.inventory.getStackInSlot(i);
|
ItemStack is = par2EntityPlayer.inventory.getStackInSlot(i);
|
||||||
if (is != null && is.getItem() instanceof ItemBiomeCapsule && is.getItemDamage() != 0) {
|
if (is != null && is.getItem() instanceof ItemBiomeCapsule && is.getItemDamage() != 0) {
|
||||||
NBTTagCompound nbt = is.stackTagCompound;
|
NBTTagCompound nbt = is.stackTagCompound;
|
||||||
@@ -40,16 +40,18 @@ public abstract class ItemBiomePainterMixin {
|
|||||||
if (charges > 0 || par2EntityPlayer.capabilities.isCreativeMode) {
|
if (charges > 0 || par2EntityPlayer.capabilities.isCreativeMode) {
|
||||||
Chunk c = par3World.getChunkFromBlockCoords(par4, par6);
|
Chunk c = par3World.getChunkFromBlockCoords(par4, par6);
|
||||||
int biomeID = is.getItemDamage() - 1;
|
int biomeID = is.getItemDamage() - 1;
|
||||||
short[] biomeArray = ((IChunkMixin)c).getBiomeShortArray(); //changed
|
short[] biomeArray = ((IChunkMixin) c).getBiomeShortArray(); //changed
|
||||||
if ((biomeArray[(par6 & 15) << 4 | par4 & 15] & 255) != biomeID) {
|
if ((biomeArray[(par6 & 15) << 4 | par4 & 15] & 255) != biomeID) {
|
||||||
biomeArray[(par6 & 15) << 4 | par4 & 15] = (short)(biomeID & 0xFFFF); //changed
|
biomeArray[(par6 & 15) << 4 | par4 & 15] = (short) (biomeID & 0xFFFF); //changed
|
||||||
((IChunkMixin)c).setBiomeShortArray(biomeArray); //changed
|
((IChunkMixin) c).setBiomeShortArray(biomeArray); //changed
|
||||||
if (!par2EntityPlayer.capabilities.isCreativeMode) {
|
if (!par2EntityPlayer.capabilities.isCreativeMode) {
|
||||||
nbt.setInteger("charges", charges - 1);
|
nbt.setInteger("charges", charges - 1);
|
||||||
par2EntityPlayer.inventoryContainer.detectAndSendChanges();
|
par2EntityPlayer.inventoryContainer.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessagePaintBiome(par4, par5, par6, par3World.provider.dimensionId, biomeID), par3World.provider.dimensionId);
|
PacketHandler.INSTANCE.sendToDimension(
|
||||||
|
new MessagePaintBiome(par4, par5, par6, par3World.provider.dimensionId, biomeID),
|
||||||
|
par3World.provider.dimensionId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loaded 100 of 160 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user