forked from headlesshq/mc-runtime-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMixinGameTestRegistry.java
More file actions
31 lines (27 loc) · 1.16 KB
/
Copy pathMixinGameTestRegistry.java
File metadata and controls
31 lines (27 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package me.earth.clientgametest.mixin;
import net.minecraft.gametest.framework.GameTestRegistry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(GameTestRegistry.class)
public class MixinGameTestRegistry {
/**
* ONLY USE IF YOU KNOW WHAT YOU ARE DOING!
* This is here just because this mod has been made to support Neoforge, Fabric and Lexforge.
* Lexforge and Neoforge prefix the name of the Structure template in a weird way.
*
* @return an unprefixed name of the gametest template to use.
*/
@ModifyArg(
method = "turnMethodIntoTestFunction",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/gametest/framework/TestFunction;<init>(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lnet/minecraft/world/level/block/Rotation;IJZIILjava/util/function/Consumer;)V"),
index = 2)
private static String turnMethodIntoTestFunctionHook(String string) {
if (string.contains("clientgametest")) {
return "clientgametest:empty";
}
return string;
}
}