kept you waiting huh.gif
kept you waiting huh

It’s been a while but here’s a short post on 2 mods I have updated to work with 1.21.11 and the headache of working with Java/Minecraft Modding

Loom sucks

Fabric loom “is a Gradle plugin for development of mods in the Fabric ecosystem”. Sadly it does the opposite sometimes. The version Fabric themselves suggest modders use, 1.14-SNAPSHOT, just outright breaks compiling.

The error is just not helpful for people who don’t do this sort of thing, blaming a fabric item with v0 in the name so I can’t imagine they did any testing with it.

I get snapshot versions are unstable, but 1.13-SNAPSHOT works without hiccup.

It’s just a minefield of errors when working with Java.

Signed Paintings

Modrinth, it’s a mod that lets you turn signs, banners and shields into images.

This was arguably the easiest update I’ve done. From 1.21.10 to 1.21.11, there were practically no changes except for some shifting of methods.

It boiled down to 2 methods being moved. RenderLayer.getEntityTranslucent and RenderLayer.getEntityCutout. They got moved to RenderLayers.entityTranslucent and RenderLayers.entityCutout respectively. No signature change.

Update the fabric version, minecraft version, yarn version, loom version to 1.13-SNAPSHOT, build the mod and done. Worked out the gate, nice little update.

Sparse Structures

Modrinth, this mod spaces out structures so they don’t generate as close to each other. Makes worlds less cluttered with structures. I always found that villages were super close if the biome was large, this solved that for me.

This was more of a headache. Mainly because this mod targets, fabric, forge and neoforge all in one project. Luckily I don’t care for forge or neoforge so I didn’t have to modify their codebases.

First was the usual suspects, gradle.properties to update defined versions such as what minecraft version, neoform version, parchment version and so on. There’s more in this file than I am used to, but the usual defines are still here. This was the most I did to forge and neoforge parts, was just to update their versions in this file to make the rest compile happily. This mod also needed loom on 1.13-SNAPSHOT.

For the most part the fabric side of things was fine, but since this is a multiloader targeting mod, there is a common side. Where lies the issues.

The offending code was a Mixin and while I have worked with those in the past I know what they do, this one stumped me. Essentially PushSpreadLimit.java targets a vanilla class to modify a constant value where it exists, specifically 4096 to change it to Integer.MAX_VALUE.

Originally the mod had it set to

@ModifyConstant(method = {"lambda$static$0", "method_40170"}, constant = @Constant(intValue = 4096))
private static int pushSpreadLimit(int original) { return Integer.MAX_VALUE ;}

This is mostly ok, but it’s the methods it were targeting that were the problem. There was no method_40170 and while the static lambda existed, for whatever reason when launching the game with just that lambda set, it crashed.

I tried over and over to figure out where it was looking for this 4096, just to come to the conclusion that the lambda$static$0 was correct, the game just didn’t like it.

I tried all different variations of lambda$static$0, some including more of the descriptor and one time used the entire descriptor of the static lambda. Still nothing. I tried to target other methods in the class, nothing.

After some back and forth with the forced labour of (insert your favourite LLM here), turns out you can just blanket target everything in the Mixin class with *.

So I did, launched the game, loads fine.. But how do I know it works..?

It doesn’t modify blocks, textures or any gameplay functionality that is visible.

Why not just throw stupid config values at it?

This mod allows modifying a spread factor per structure, by default this is set to 2, so structures can be twice the distance between each other. This is around 131072 blocks, where 65536 is the default.

Screw it, woodland mansion, spread factor, 999.

Loaded a world, /locate structure minecraft:mansion, closest woodland mansion 3757532 blocks away. 3.7 million blocks from spawn. Safe to say it works again.

(insert your favourite LLM here) got some brownie points for this one. Mixins are a black box as far as I’m concerned, I thought they were a bit more specific in their targeting and much preferred verbose targets over the literal any match. I’ll figure them out eventually..

Tadaaa

I hate modding minecraft, java just sucks. It doesn’t help that IDEs can’t help all that well because… java just sucks.

I’m not gonna upload the built mods anywhere, their licenses likely won’t allow it, and I can’t be bothered to create PRs for either. I’m sure they both will get round to updating to support 1.21.11 on their own.