File tree Expand file tree Collapse file tree 7 files changed +33
-30
lines changed
java/org/machinemc/generators Expand file tree Collapse file tree 7 files changed +33
-30
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,6 @@ repositories {
17
17
18
18
dependencies {
19
19
20
- sequenceOf(
21
- " machine-materials" ,
22
- " machine-blockdata" ,
23
- ).forEach {
24
- implementation(files(" /libs/$it .jar" ))
25
- }
26
-
27
20
implementation(libs.machine.nbt)
28
21
implementation(libs.machine.scriptive)
29
22
implementation(libs.jetbrains.annotations) // overrides default compileOnly
Original file line number Diff line number Diff line change @@ -32,21 +32,24 @@ private Generators() {
32
32
*/
33
33
public static void run (final File projectDir ) {
34
34
try {
35
- if (projectDir .isFile ()) return ;
36
- final File outputDir = new File (projectDir .getPath () + "/libs" );
37
- if (!outputDir .exists () && !outputDir .mkdirs ())
38
- throw new IOException ("Folder for Machine libraries could not be created" );
39
-
40
- final CodeGenerator materials = new MaterialsLibGenerator (outputDir );
41
- if (!materials .isExists ()) materials .generate ();
42
-
43
- final CodeGenerator blockdata = new BlockDataLibGenerator (outputDir );
44
- if (!blockdata .isExists ()) blockdata .generate ();
45
-
35
+ run0 (projectDir );
46
36
} catch (Throwable throwable ) {
47
37
System .out .println ("Machine Library Generator unexpectedly ended." );
48
38
throw new RuntimeException (throwable );
49
39
}
50
40
}
51
41
42
+ private static void run0 (final File projectDir ) throws Throwable {
43
+ if (projectDir .isFile ()) return ;
44
+ final File outputDir = new File (projectDir .getPath () + "/libs" );
45
+ if (!outputDir .exists () && !outputDir .mkdirs ())
46
+ throw new IOException ("Folder for Machine libraries could not be created" );
47
+
48
+ final CodeGenerator materials = new MaterialsLibGenerator (outputDir );
49
+ if (!materials .isExists ()) materials .generate ();
50
+
51
+ final CodeGenerator blockdata = new BlockDataLibGenerator (outputDir );
52
+ if (!blockdata .isExists ()) blockdata .generate ();
53
+ }
54
+
52
55
}
Original file line number Diff line number Diff line change @@ -427,7 +427,7 @@ else if (property.getType() == Property.Type.NUMBER)
427
427
// loadProperties method
428
428
mv = cw .visitMethod (Opcodes .ACC_PROTECTED ,
429
429
"loadProperties" ,
430
- "(" + Type . getType ( Object []. class ). getDescriptor () + " )V" ,
430
+ "([Ljava/lang/Object; )V" ,
431
431
null ,
432
432
new String [0 ]);
433
433
mv .visitAnnotation (Type .getType (Override .class ).getDescriptor (), true ).visitEnd ();
Original file line number Diff line number Diff line change 22
22
import org .objectweb .asm .ClassWriter ;
23
23
import org .objectweb .asm .MethodVisitor ;
24
24
import org .objectweb .asm .Opcodes ;
25
- import org .objectweb .asm .Type ;
26
25
27
26
import java .io .File ;
28
27
import java .io .IOException ;
@@ -51,7 +50,7 @@ public void generate() throws IOException {
51
50
CodeGenerator .visitGeneratedAnnotation (cw , BlockDataLibGenerator .class );
52
51
final MethodVisitor mv = cw .visitMethod (Opcodes .ACC_PUBLIC | Opcodes .ACC_ABSTRACT ,
53
52
"getName" ,
54
- "()" + Type . getType ( String . class ). getDescriptor () ,
53
+ "()Ljava/lang/ String;" ,
55
54
null ,
56
55
new String [0 ]);
57
56
mv .visitEnd ();
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ public byte[] generate() {
147
147
// getName method
148
148
mv = cw .visitMethod (Opcodes .ACC_PUBLIC ,
149
149
"getName" ,
150
- "()" + org . objectweb . asm . Type . getType ( String . class ). getDescriptor () ,
150
+ "()Ljava/lang/ String;" ,
151
151
null ,
152
152
new String [0 ]);
153
153
mv .visitAnnotation (org .objectweb .asm .Type .getType (Override .class ).getDescriptor (), true ).visitEnd ();
Original file line number Diff line number Diff line change 1
1
import org.machinemc.generators.LibraryGeneratorPlugin
2
2
3
- apply<LibraryGeneratorPlugin >()
3
+ plugins {
4
+ `java- library`
5
+ }
6
+
7
+ apply<LibraryGeneratorPlugin >()
8
+
9
+ dependencies {
10
+
11
+ sequenceOf(
12
+ " machine-materials" ,
13
+ " machine-blockdata" ,
14
+ ).forEach {
15
+ implementation(files(" libs/$it .jar" ))
16
+ }
17
+
18
+ }
Original file line number Diff line number Diff line change @@ -20,13 +20,6 @@ dependencies {
20
20
21
21
implementation(project(" :api" ))
22
22
23
- sequenceOf(
24
- " machine-materials" ,
25
- " machine-blockdata" ,
26
- ).forEach {
27
- implementation(files(" libs/$it .jar" ))
28
- }
29
-
30
23
implementation(libs.google.guava)
31
24
implementation(libs.google.gson)
32
25
implementation(libs.netty.all)
You can’t perform that action at this time.
0 commit comments