Skip to content
Advertisement

Forge 1.12.2 Coremodding: java.lang.StringIndexOutOfBoundsException

I try to make a coremod on 1.12.2 Forge in order to patch some missing stuff in the Lost Cities mod. (Source: https://github.com/McJtyMods/LostCities/blob/1.12/src/main/java/mcjty/lostcities/dimensions/world/lost/BuildingInfo.java)

A friend and I have written this LostCitiesClassTransformer.java: (Full source: https://github.com/Nick1st/LCPatches)

JavaScript

The original code I want to patch (Bytecode Outline):

JavaScript

The Bytecode Outline containing my changes:

JavaScript

The stacktrace I get:

JavaScript

Why do I monkey-patch a open-source mod? I need it for a modpack; Curseforge doesn’t allow modified jars in modpacks. McJty said, that he don’t want a second LC Project, but he’s fine with patching LC using coremods/mixins etc.

Any help would be appreciated. If you need to know more details, feel free to ask. Thanks in advance.

Advertisement

Answer

Here’s the problem:

JavaScript

You’re trying to call floorsBelowGround like it’s a method, but it’s actually a field. You need to make a GETFIELD FieldInsnNode instead of an INVOKEVIRTUAL MethodInsnNode.

Advertisement