Compare commits

...
8 Commits
13 changed files with 98 additions and 81 deletions

No files matched your search

+12
View File
@@ -45,6 +45,18 @@ metadata `32767` as the OreDictionary wildcard value.
Using this specific metadata value in the world is fine if you convert it into item NBT or similar when the block is broken for pick-up.
## Strict No LLM / No AI Policy
No LLMs for issues.
No LLMs for patches / pull requests.
No LLMs for comments on the bug tracker, including translation.
English is encouraged, but not required. You are welcome to post in your native
language and rely on others to have their own translation tools of choice to
interpret your words.
## Mod compat
This mod also contains patches for the following mods:
+2 -2
View File
@@ -1,5 +1,5 @@
plugins {
id("com.falsepattern.fpgradle-mc") version ("2.1.0")
id("com.falsepattern.fpgradle-mc") version ("4.0.2")
}
group = "com.falsepattern"
@@ -64,7 +64,7 @@ repositories {
dependencies {
// region Our deps
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.9.0")
implementationSplit("com.falsepattern:falsepatternlib-mc1.7.10:1.12.0")
compileOnly("it.unimi.dsi:fastutil:8.5.16")
implementationSplit("com.falsepattern:chunkapi-mc1.7.10:0.8.0")
// endregion
Binary file not shown.
+3 -1
View File
@@ -1,7 +1,9 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored Regular → Executable
+1 -1
View File
@@ -57,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Vendored
+10 -21
View File
@@ -23,8 +23,8 @@
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Set local scope for the variables, and ensure extensions are enabled
setlocal EnableExtensions
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@@ -51,7 +51,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
"%COMSPEC%" /c exit 1
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
@@ -65,7 +65,7 @@ echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
"%COMSPEC%" /c exit 1
:execute
@rem Setup the command line
@@ -73,21 +73,10 @@ goto fail
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
:exitWithErrorLevel
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
"%COMSPEC%" /c exit %ERRORLEVEL%
@@ -43,7 +43,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent;
name = Tags.MODNAME,
acceptedMinecraftVersions = "[1.7.10]",
dependencies = "required-after:chunkapi@[0.8.0,);" +
"required-after:falsepatternlib@[1.9.0,);" +
"required-after:falsepatternlib@[1.12.0,);" +
"after:antiidconflict")
public class EndlessIDs {
public static final byte[] ZERO_LENGTH_BIOME_ARRAY_PLACEHOLDER = new byte[0];
@@ -80,18 +80,18 @@ public class EndlessIDsCore implements IFMLLoadingPlugin, IEarlyMixinLoader {
@SuppressWarnings("unchecked")
val exceptions = (Set<String>) field.get(cl);
if (exceptions.contains("code.elix_x.coremods")) {
EndlessIDsTransformer.logger.info("AntiIDConflict detected!");
EndlessIDsTransformer.logger.info("Removing ASM protections so that we can fix its code.");
Share.logger.info("AntiIDConflict detected!");
Share.logger.info("Removing ASM protections so that we can fix its code.");
exceptions.remove("code.elix_x.coremods");
exceptions.add("code.elix_x.coremods.antiidconflict.core");
exceptions.add("code.elix_x.coremods.antiidconflict.ByteCodeTester");
}
return new String[]{EndlessIDsTransformer.class.getName()};
return new String[]{Tags.GROUPNAME + ".asm.EndlessIDsTransformer" };
}
private static void loudCrash(String message) {
for (int i = 0; i < 100; i++) {
EndlessIDsTransformer.logger.fatal(message);
Share.logger.fatal(message);
}
val err = new Error(message);
err.setStackTrace(new StackTraceElement[0]);
@@ -22,7 +22,6 @@
package com.falsepattern.endlessids.asm;
import com.falsepattern.endlessids.Tags;
import com.falsepattern.endlessids.asm.transformer.DevFixer;
import com.falsepattern.endlessids.asm.transformer.FmlRegistry;
import com.falsepattern.endlessids.asm.transformer.GameDataAccelerator;
@@ -33,14 +32,11 @@ import com.falsepattern.endlessids.config.GeneralConfig;
import com.falsepattern.lib.turboasm.MergeableTurboTransformer;
import com.falsepattern.lib.turboasm.TurboClassTransformer;
import lombok.val;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
public class EndlessIDsTransformer extends MergeableTurboTransformer {
public static final Logger logger = LogManager.getLogger(Tags.MODNAME + " ASM");
private static List<TurboClassTransformer> transformers() {
val result = new ArrayList<TurboClassTransformer>();
@@ -0,0 +1,33 @@
/*
* EndlessIDs
*
* Copyright (C) 2022-2026 FalsePattern, The MEGA Team
* All Rights Reserved
*
* The above copyright notice, this permission notice and the word "MEGA"
* shall be included in all copies or substantial portions of the Software.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.endlessids.asm;
import com.falsepattern.endlessids.Tags;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public final class Share {
public static final Logger logger = LogManager.getLogger(Tags.MODNAME + " ASM");
private Share() {}
}
@@ -22,9 +22,9 @@
package com.falsepattern.endlessids.asm.transformer;
import com.falsepattern.endlessids.asm.Share;
import com.falsepattern.endlessids.Tags;
import com.falsepattern.endlessids.asm.AsmTransformException;
import com.falsepattern.endlessids.asm.EndlessIDsTransformer;
import com.falsepattern.endlessids.config.GeneralConfig;
import com.falsepattern.lib.turboasm.ClassNodeHandle;
import com.falsepattern.lib.turboasm.TurboClassTransformer;
@@ -64,7 +64,7 @@ public class GameDataAccelerator implements TurboClassTransformer {
}
private static void transformError(MethodNode method) {
EndlessIDsTransformer.logger.error("Could not add caching code to GameData." + method.name + method.desc);
Share.logger.error("Could not add caching code to GameData.{}{}", method.name, method.desc);
}
private void transformRegisterBlock(MethodNode method) {
@@ -24,7 +24,6 @@ package com.falsepattern.endlessids.asm.transformer;
import com.falsepattern.endlessids.Tags;
import com.falsepattern.endlessids.asm.EndlessIDsCore;
import com.falsepattern.endlessids.asm.EndlessIDsTransformer;
import com.falsepattern.lib.turboasm.ClassNodeHandle;
import com.falsepattern.lib.turboasm.TurboClassTransformer;
import lombok.val;
@@ -22,9 +22,10 @@
package com.falsepattern.endlessids.asm.transformer.chunk;
import com.falsepattern.endlessids.asm.Share;
import com.falsepattern.endlessids.Tags;
import com.falsepattern.endlessids.asm.EndlessIDsCore;
import com.falsepattern.endlessids.asm.EndlessIDsTransformer;
import com.falsepattern.lib.turboasm.BytePatternMatcher;
import com.falsepattern.lib.turboasm.ClassNodeHandle;
import com.falsepattern.lib.turboasm.TurboClassTransformer;
import lombok.Data;
@@ -44,7 +45,10 @@ import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.VarInsnNode;
import net.minecraft.launchwrapper.Launch;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.BiFunction;
@@ -181,22 +185,34 @@ public class ChunkProviderSuperPatcher implements TurboClassTransformer {
private static State<AbstractInsnNode> STATE17 = null;
private static State<AbstractInsnNode> STATE_FINAL = null;
private static final BytePatternMatcher chunkClassMatcher;
private static final BytePatternMatcher getBiomeArrayMethodMatcher;
static {
var chunk = new ArrayList<String>(4);
if (EndlessIDsCore.deobfuscated) {
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"};
chunk.add("net/minecraft/world/chunk/Chunk");
FIELD_biomeID = new String[]{"biomeID"};
METHOD_getBiomeArray = new String[]{"getBiomeArray"};
} else {
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"};
chunk.add("apx");
chunk.add("net/minecraft/world/chunk/Chunk");
FIELD_biomeID = new String[]{"ay", "field_76756_M"};
METHOD_getBiomeArray = new String[]{"m", "func_76605_m"};
}
val chunkExtraSpool = Launch.blackboard.get("endlessids_spool_CLASS_Chunk_interop");
if (chunkExtraSpool instanceof String[]) {
chunk.addAll(Arrays.asList((String[]) chunkExtraSpool));
}
CLASS_Chunk = chunk.toArray(new String[0]);
chunkClassMatcher = new BytePatternMatcher(CLASS_Chunk, BytePatternMatcher.Mode.Equals);
getBiomeArrayMethodMatcher = new BytePatternMatcher(METHOD_getBiomeArray, BytePatternMatcher.Mode.Equals);
}
static {
@@ -347,35 +363,6 @@ public class ChunkProviderSuperPatcher implements TurboClassTransformer {
});
}
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)) {
@@ -456,17 +443,16 @@ public class ChunkProviderSuperPatcher implements TurboClassTransformer {
@Override
public boolean shouldTransformClass(@NotNull String className, @NotNull ClassNodeHandle classNode) {
if ("net.minecraft.world.chunk.storage.AnvilChunkLoader".equals(className))
if ("net.minecraft.world.chunk.storage.AnvilChunkLoader".equals(className)) {
return false;
val cn = classNode.getNode();
if (cn == null)
return false;
for (MethodNode method : cn.methods) {
if (scanForBrokenCall(method)) {
return true;
}
}
return false;
val metadata = classNode.getOriginalMetadata();
if (metadata == null) {
return false;
}
return metadata.matchesBytes(chunkClassMatcher) && metadata.matchesBytes(getBiomeArrayMethodMatcher);
}
@Override
@@ -479,7 +465,7 @@ public class ChunkProviderSuperPatcher implements TurboClassTransformer {
val memory = findTheTarget(method, cn);
if (memory != null) {
patched = true;
EndlessIDsTransformer.logger.debug("[ChunkProvider patcher]: Match found in method " + method.name);
Share.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) {
@@ -496,7 +482,7 @@ public class ChunkProviderSuperPatcher implements TurboClassTransformer {
}
}
if (!patched) {
EndlessIDsTransformer.logger.debug("[ChunkProvider patcher]: No matches found in class! This is not explicitly " +
Share.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!");
}
return patched;
@@ -664,4 +650,4 @@ public class ChunkProviderSuperPatcher implements TurboClassTransformer {
}
}
}
}
}