Skip to content

Commit b947e77

Browse files
committed
NBT类型和目标选择器类型的基本库
1 parent e800817 commit b947e77

26 files changed

+197
-97
lines changed

mcfpp/lang/mcfpp.lang.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"files": [
33
"*"
44
],
5+
"mainSrc": {
6+
"mcfpp": ["src/main/mcfpp"],
7+
"resource": ["src/main/resource"]
8+
},
59
"description": "",
610
"namespace": "mcfpp.lang",
711
"targetPath": "null",

src/main/java/top/mcfpp/annotations/MNIRegister.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@
1515
String caller() default "void";
1616
String returnType() default "void";
1717

18+
boolean override() default false;
19+
1820
}

src/main/java/top/mcfpp/mni/BaseMNIMethodContainer.java

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package top.mcfpp.mni;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import top.mcfpp.annotations.MNIRegister;
5+
import top.mcfpp.lang.JavaVar;
6+
import top.mcfpp.lang.JsonTextConcrete;
7+
import top.mcfpp.lang.Var;
8+
import top.mcfpp.lib.ListChatComponent;
9+
import top.mcfpp.lib.PlainChatComponent;
10+
import top.mcfpp.util.ValueWrapper;
11+
12+
import java.util.UUID;
13+
14+
public class MCAnyConcreteData {
15+
16+
@MNIRegister(normalParams = {"any a"}, returnType = "JavaVar")
17+
public static void getJavaVar(@NotNull Var<?> value, ValueWrapper<Var<?>> returnValue){
18+
var re = new JavaVar(value, UUID.randomUUID().toString());
19+
returnValue.setValue(re);
20+
}
21+
22+
@MNIRegister(caller = "any", returnType = "text")
23+
public static void toText(@NotNull Var<?> caller, ValueWrapper<JsonTextConcrete> returnValue){
24+
var l = new ListChatComponent();
25+
l.getComponents().add(new PlainChatComponent(caller.toString()));
26+
returnValue.setValue(new JsonTextConcrete(l, "re"));
27+
}
28+
}

src/main/java/top/mcfpp/mni/MCAnyData.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
package top.mcfpp.mni;
22

3-
import kotlin.jvm.functions.Function4;
43
import org.jetbrains.annotations.NotNull;
54
import top.mcfpp.annotations.MNIRegister;
6-
import top.mcfpp.lang.*;
7-
import top.mcfpp.lib.ChatComponent;
5+
import top.mcfpp.lang.JavaVar;
6+
import top.mcfpp.lang.JsonTextConcrete;
7+
import top.mcfpp.lang.Var;
88
import top.mcfpp.lib.ListChatComponent;
99
import top.mcfpp.lib.PlainChatComponent;
10-
import top.mcfpp.model.function.Function;
11-
import top.mcfpp.model.function.MNIMethodContainer;
1210
import top.mcfpp.util.ValueWrapper;
1311

14-
import java.util.HashMap;
1512
import java.util.UUID;
1613

1714
public class MCAnyData {

src/main/java/top/mcfpp/mni/MCIntConcreteData.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
import top.mcfpp.annotations.MNIRegister;
44
import top.mcfpp.lang.JsonTextConcrete;
5-
import top.mcfpp.lang.MCInt;
65
import top.mcfpp.lang.MCIntConcrete;
76
import top.mcfpp.lib.ListChatComponent;
87
import top.mcfpp.lib.PlainChatComponent;
9-
import top.mcfpp.lib.ScoreChatComponent;
108
import top.mcfpp.util.ValueWrapper;
119

1210
public class MCIntConcreteData {
1311

14-
@MNIRegister(caller = "int", returnType = "text")
12+
@MNIRegister(caller = "int", returnType = "text", override = true)
1513
public static void toText(MCIntConcrete caller, ValueWrapper<JsonTextConcrete> returnValue) {
1614
var l = new ListChatComponent();
1715
l.getComponents().add(new PlainChatComponent(caller.getValue().toString()));

src/main/java/top/mcfpp/mni/MCIntData.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
package top.mcfpp.mni;
22

33
import top.mcfpp.annotations.MNIRegister;
4-
import top.mcfpp.lang.JavaVar;
54
import top.mcfpp.lang.JsonTextConcrete;
65
import top.mcfpp.lang.MCInt;
76
import top.mcfpp.lib.ListChatComponent;
87
import top.mcfpp.lib.ScoreChatComponent;
9-
import top.mcfpp.model.function.Function;
108
import top.mcfpp.util.ValueWrapper;
119

1210
public class MCIntData {
1311

14-
@MNIRegister(caller = "int", returnType = "text")
12+
@MNIRegister(caller = "int", returnType = "text", override = true)
1513
public static void toText(MCInt caller, ValueWrapper<JsonTextConcrete> returnValue) {
1614
var l = new ListChatComponent();
1715
l.getComponents().add(new ScoreChatComponent(caller));
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package top.mcfpp.mni;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import top.mcfpp.annotations.MNIRegister;
5+
import top.mcfpp.lang.JsonTextConcrete;
6+
import top.mcfpp.lang.NBTBasedDataConcrete;
7+
import top.mcfpp.lib.ListChatComponent;
8+
import top.mcfpp.lib.PlainChatComponent;
9+
import top.mcfpp.util.ValueWrapper;
10+
11+
public class NBTBasedDataConcreteData {
12+
13+
@MNIRegister(caller = "nbt", returnType = "text")
14+
public static void toText(@NotNull NBTBasedDataConcrete<?> caller, ValueWrapper<JsonTextConcrete> returnValue){
15+
var l = new ListChatComponent();
16+
l.getComponents().add(new PlainChatComponent(caller.getValue().valueToString()));
17+
returnValue.setValue(new JsonTextConcrete(l, "re"));
18+
}
19+
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package top.mcfpp.mni;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
import top.mcfpp.annotations.MNIRegister;
5+
import top.mcfpp.lang.JsonTextConcrete;
6+
import top.mcfpp.lang.NBTBasedData;
7+
import top.mcfpp.lib.ListChatComponent;
8+
import top.mcfpp.lib.NBTChatComponent;
9+
import top.mcfpp.util.ValueWrapper;
10+
11+
public class NBTBasedDataData {
12+
13+
@MNIRegister(caller = "nbt", returnType = "text")
14+
public static void toText(@NotNull NBTBasedData<?> caller, ValueWrapper<JsonTextConcrete> returnValue){
15+
var l = new ListChatComponent();
16+
l.getComponents().add(new NBTChatComponent(caller, false, null));
17+
returnValue.setValue(new JsonTextConcrete(l, "re"));
18+
}
19+
20+
}

src/main/java/top/mcfpp/mni/NBTListConcreteData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.Objects;
2222
import java.util.UUID;
2323

24-
public class NBTListConcreteData extends BaseMNIMethodContainer {
24+
public class NBTListConcreteData {
2525

2626
@InsertCommand
2727
@MNIRegister(normalParams = {"E e"}, caller = "list<E>")

0 commit comments

Comments
 (0)