Skip to content

Commit 67efa8a

Browse files
committed
build: make sure 1.21.11 receives proper decompilations again
1 parent 88d715d commit 67efa8a

5 files changed

Lines changed: 131 additions & 110 deletions

File tree

build-src/src/main/kotlin/moulconfig.fabric.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ val aF = project.file("src/main/resources/moulconfig.accesswidener")
1717
val hasAW = aF.exists()
1818
the<UniminedExtension>().minecraft {
1919
version(minecraftVersion)
20-
2120
if (!isDeobfuscated) {
2221
mappings {
2322
intermediary()
2423
mojmap()
24+
// unimined currently incorrectly renames 1.21.11 namespaces to official instead of above 1.21.11
25+
devNamespace("mojmap")
2526
}
2627
}
2728

modern/1.21.11/gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
moulconfig.minecraft=1.21.11
2-
moulconfig.yarn=2
3-
moulconfig.fabric=0.135.1+1.21.11
2+
moulconfig.yarn=4
3+
moulconfig.fabric=0.141.3+1.21.11
4+
moulconfig.rlv1=true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package io.github.notenoughupdates.moulconfig.test;
2+
3+
import com.mojang.brigadier.arguments.ArgumentType;
4+
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
5+
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
6+
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
7+
8+
public class CommandUtils {
9+
public static LiteralArgumentBuilder<FabricClientCommandSource> literal(String name) {
10+
return LiteralArgumentBuilder.literal(name);
11+
}
12+
public static <T> RequiredArgumentBuilder<FabricClientCommandSource, T> argument(String name, ArgumentType<T> type) {
13+
return RequiredArgumentBuilder.argument(name, type);
14+
}
15+
16+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
package io.github.notenoughupdates.moulconfig.test;
2+
3+
import io.github.notenoughupdates.moulconfig.common.IItemStack;
4+
import io.github.notenoughupdates.moulconfig.common.IMinecraft;
5+
import io.github.notenoughupdates.moulconfig.common.MyResourceLocation;
6+
import io.github.notenoughupdates.moulconfig.gui.CloseEventListener;
7+
import io.github.notenoughupdates.moulconfig.managed.ManagedConfig;
8+
import io.github.notenoughupdates.moulconfig.observer.ObservableList;
9+
import io.github.notenoughupdates.moulconfig.platform.MoulConfigPlatform;
10+
import io.github.notenoughupdates.moulconfig.xml.Bind;
11+
import io.github.notenoughupdates.moulconfig.xml.XMLUniverse;
12+
import net.fabricmc.api.ModInitializer;
13+
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
14+
import net.minecraft.client.Minecraft;
15+
import net.minecraft.world.item.ItemStack;
16+
import net.minecraft.world.level.block.Blocks;
17+
18+
import java.io.File;
19+
import java.util.ArrayList;
20+
import java.util.Arrays;
21+
import java.util.Random;
22+
23+
import static io.github.notenoughupdates.moulconfig.test.CommandUtils.literal;
24+
25+
public class FabricMain implements ModInitializer {
26+
@Override
27+
public void onInitialize() {
28+
if (!"true".equals(System.getProperty("moulconfig.testmod"))) return;
29+
ManagedConfig<TestConfig> config = ManagedConfig.create(new File("config/moulconfig/test.json"), TestConfig.class);
30+
ClientCommandRegistrationCallback.EVENT.register((a, b) -> {
31+
a.register(literal("moulconfig").executes(ctx -> {
32+
Minecraft.getInstance().schedule(() -> {
33+
var editor = config.getEditor();
34+
editor.setWide(config.getInstance().getTestCategoryA().isWide());
35+
IMinecraft.INSTANCE.openWrappedScreen(editor);
36+
});
37+
return 0;
38+
}));
39+
a.register(literal("moulconfigxml").executes(ctx -> {
40+
Minecraft.getInstance().schedule(() -> {
41+
XMLUniverse xmlUniverse = XMLUniverse.getDefaultUniverse();
42+
var scene = xmlUniverse.load(
43+
new ObjectBound(),
44+
IMinecraft.INSTANCE.loadResourceLocation(MyResourceLocation.Companion.parse("moulconfig:test.xml"))
45+
);
46+
IMinecraft.getInstance()
47+
.openWrappedScreen(scene);
48+
});
49+
return 0;
50+
}));
51+
});
52+
}
53+
54+
public static class Element {
55+
@Bind
56+
public String text;
57+
58+
@Bind
59+
public boolean enabled = false;
60+
61+
public Element(String text) {
62+
this.text = text;
63+
}
64+
65+
@Bind
66+
public void randomize() {
67+
text = "§" + "abcdef0123456789".charAt(new Random().nextInt(16)) + text.replaceAll("§.", "");
68+
}
69+
}
70+
71+
public static class ObjectBound {
72+
@Bind
73+
public Runnable requestClose = null;
74+
75+
@Bind
76+
public void afterClose() {
77+
System.out.println("After close");
78+
}
79+
80+
@Bind
81+
public CloseEventListener.CloseAction beforeClose() {
82+
System.out.println("Before close");
83+
return CloseEventListener.CloseAction.NO_OBJECTIONS_TO_CLOSE;
84+
}
85+
86+
@Bind
87+
public IItemStack itemStack = MoulConfigPlatform.wrap(new ItemStack(Blocks.SAND));
88+
89+
@Bind
90+
public boolean value = false;
91+
92+
@Bind
93+
public String textField = "";
94+
95+
@Bind
96+
public float slider = 0f;
97+
98+
@Bind
99+
public void addElement() {
100+
data.add(new Element(textField));
101+
textField = "";
102+
}
103+
104+
@Bind
105+
public ObservableList<Element> data =
106+
new ObservableList<>(new ArrayList<>(Arrays.asList(
107+
new Element("Test 1"), new Element("Test 2"), new Element("Test 3")
108+
)));
109+
}
110+
}

modern/templates/java/io/github/notenoughupdates/moulconfig/test/FabricMain.kt

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)