diff --git a/src/main/java/com/falsepattern/endlessids/asm/transformer/ChunkProviderSuperPatcher.java b/src/main/java/com/falsepattern/endlessids/asm/transformer/ChunkProviderSuperPatcher.java index ff6e3b9..02c5caa 100644 --- a/src/main/java/com/falsepattern/endlessids/asm/transformer/ChunkProviderSuperPatcher.java +++ b/src/main/java/com/falsepattern/endlessids/asm/transformer/ChunkProviderSuperPatcher.java @@ -25,10 +25,57 @@ import java.util.function.BiFunction; import java.util.function.Function; /** - * This class is the bread and butter of the patching logic from now on. It covers about 90% of cases where manual patching - * was required, and so with a heavy heart, I (finally) implemented a universal patch. + *
This class is the bread and butter of the patching logic from now on. It covers about 90% of cases where manual patching + * was required, and so with a heavy heart, I (finally) implemented a universal patch.
* - * See the end of the file for the 2 possibilities that this transformer handles. + *
+ * Java form:
+ * ...
+ * byte[] abyte = chunk.getBiomeArray(); //replace byte[] with short[] and getBiomeArray with getBiomeShortArray
+ *
+ * for (int k = 0; k < abyte.length; ++k) {
+ * //Possibility A:
+ * abyte[k] = (byte)abiomegenbase[k].biomeID; //from local variable //replace byte cast with short cast
+ *
+ * //Possibility B:
+ * abyte[k] = (byte)this.biomesToGenerate[k].biomeID; //from arbitrary field //replace byte cast with short cast
+ * }
+ * ...
+ * In ASM form:
+ *
+ * L1
+ * ALOAD chunk
+ * INVOKEVIRTUAL net/minecraft/world/chunk/Chunk.getBiomeArray ()[B //Replace with INVOKEVIRTUAL net/minecraft/world/chunk/Chunk.getBiomeShortArray ()[S
+ * ASTORE abyte
+ * L2
+ * ICONST_0
+ * ISTORE k
+ * L3
+ * FRAME
+ * ILOAD k
+ * ALOAD abyte
+ * ARRAYLENGTH
+ * IF_ICMPGE L6
+ * L4
+ * ALOAD abyte
+ * ILOAD k
+ *
+ * //Possibility A:
+ * ALOAD abiomegenbase
+ * //Possibility B:
+ * ALOAD
+ * GETFIELD classname.fieldname : [Lnet/minecraft/world/biome/BiomeGenBase;
+ *
+ * ILOAD k
+ * AALOAD
+ * GETFIELD net/minecraft/world/biome/BiomeGenBase.biomeID : I
+ * I2B //Replace with I2S
+ * BASTORE //Replace with SASTORE
+ * L5
+ * IINC k 1
+ * GOTO L3
+ * L6
+ *
*/
public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
private static final String BIOME_GEN_BASE_CLASS = "net/minecraft/world/biome/BiomeGenBase";
@@ -274,52 +321,4 @@ public class ChunkProviderSuperPatcher implements IClassNodeTransformer {
final List