Skip to content

Commit 50fc921

Browse files
committed
filter-repo src
git filter-repo --path core/src/mindustryX --invert-paths --prune-empty=never --force
1 parent 95c3691 commit 50fc921

File tree

61 files changed

+117
-11488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+117
-11488
lines changed

patches/client/0002-API-MindustryXApi.patch

-26
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,3 @@ From: way-zer <[email protected]>
33
Date: Sun, 17 Sep 2023 11:51:44 +0800
44
Subject: [PATCH] API: @MindustryXApi
55

6-
---
7-
core/src/mindustryX/MindustryXApi.java | 15 +++++++++++++++
8-
1 file changed, 15 insertions(+)
9-
create mode 100644 core/src/mindustryX/MindustryXApi.java
10-
11-
diff --git a/core/src/mindustryX/MindustryXApi.java b/core/src/mindustryX/MindustryXApi.java
12-
new file mode 100644
13-
index 0000000000000000000000000000000000000000..04318b009a90b632bf7947910ca24055c3f7e7bb
14-
--- /dev/null
15-
+++ b/core/src/mindustryX/MindustryXApi.java
16-
@@ -0,0 +1,15 @@
17-
+package mindustryX;
18-
+
19-
+import java.lang.annotation.*;
20-
+
21-
+@Documented
22-
+@Retention(RetentionPolicy.SOURCE)
23-
+@Target({ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
24-
+public @interface MindustryXApi{
25-
+ /** Need Keep for compatibility with vanilla */
26-
+ @Documented
27-
+ @Retention(RetentionPolicy.SOURCE)
28-
+ @Target({ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
29-
+ public @interface Keep{
30-
+ }
31-
+}

patches/client/0004-API-Hooks.patch

+4-29
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ Date: Wed, 3 Apr 2024 21:57:24 +0800
44
Subject: [PATCH] API: Hooks
55

66
---
7-
core/src/mindustry/ClientLauncher.java | 1 +
8-
core/src/mindustry/Vars.java | 1 +
9-
core/src/mindustryX/Hooks.java | 17 +++++++++++++++++
10-
server/src/mindustry/server/ServerLauncher.java | 1 +
11-
4 files changed, 20 insertions(+)
12-
create mode 100644 core/src/mindustryX/Hooks.java
7+
core/src/mindustry/ClientLauncher.java | 1 +
8+
core/src/mindustry/Vars.java | 1 +
9+
server/src/mindustry/server/ServerLauncher.java | 1 +
10+
3 files changed, 3 insertions(+)
1311

1412
diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java
1513
index c68681b7a9d6caf8e0ed8dace53b839efbf34eb5..1b5a25a7cbbd00c5a8e463ec722fb3b3ac5da9d6 100644
@@ -35,29 +33,6 @@ index d7756c3df025ba0e76882f656501d7d560c87114..d6b74b8a99a5ae12248f4dead618a374
3533
Groups.init();
3634

3735
if(loadLocales){
38-
diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java
39-
new file mode 100644
40-
index 0000000000000000000000000000000000000000..499a9f3403c6769288ad44e7fb4a68ffb36bc591
41-
--- /dev/null
42-
+++ b/core/src/mindustryX/Hooks.java
43-
@@ -0,0 +1,17 @@
44-
+package mindustryX;
45-
+
46-
+import arc.*;
47-
+import arc.util.*;
48-
+
49-
+public class Hooks implements ApplicationListener{
50-
+ /** invoke before `Vars.init`. Note that may be executed from `Vars.loadAsync` */
51-
+ public static void beforeInit(){
52-
+ Log.infoTag("MindustryX", "Hooks.beforeInit");
53-
+ }
54-
+
55-
+ /** invoke after loading, just before `Mod::init` */
56-
+ @Override
57-
+ public void init(){
58-
+ Log.infoTag("MindustryX", "Hooks.init");
59-
+ }
60-
+}
6136
diff --git a/server/src/mindustry/server/ServerLauncher.java b/server/src/mindustry/server/ServerLauncher.java
6237
index 1aea11b2cc877ef9a35280575e6419d9fab16f01..1799c999b2affdc0de392841212edc1f544e4751 100644
6338
--- a/server/src/mindustry/server/ServerLauncher.java

patches/client/0005-CS-Bundle-Extend.patch

+2-47
Original file line numberDiff line numberDiff line change
@@ -4,55 +4,10 @@ Date: Tue, 9 Apr 2024 18:21:28 +0800
44
Subject: [PATCH] CS: Bundle Extend
55

66
---
7-
core/assets/bundles/bundle-mdtx.properties | 0
8-
core/src/mindustryX/Hooks.java | 22 ++++++++++++++++++++++
9-
2 files changed, 22 insertions(+)
7+
core/assets/bundles/bundle-mdtx.properties | 0
8+
1 file changed, 0 insertions(+), 0 deletions(-)
109
create mode 100644 core/assets/bundles/bundle-mdtx.properties
1110

1211
diff --git a/core/assets/bundles/bundle-mdtx.properties b/core/assets/bundles/bundle-mdtx.properties
1312
new file mode 100644
1413
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
15-
diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java
16-
index 499a9f3403c6769288ad44e7fb4a68ffb36bc591..ca6144798666f96ee074838e489b51df1a10d19d 100644
17-
--- a/core/src/mindustryX/Hooks.java
18-
+++ b/core/src/mindustryX/Hooks.java
19-
@@ -1,12 +1,16 @@
20-
package mindustryX;
21-
22-
import arc.*;
23-
+import arc.files.*;
24-
import arc.util.*;
25-
26-
+import java.util.*;
27-
+
28-
public class Hooks implements ApplicationListener{
29-
/** invoke before `Vars.init`. Note that may be executed from `Vars.loadAsync` */
30-
public static void beforeInit(){
31-
Log.infoTag("MindustryX", "Hooks.beforeInit");
32-
+ registerBundle();
33-
}
34-
35-
/** invoke after loading, just before `Mod::init` */
36-
@@ -14,4 +18,22 @@ public class Hooks implements ApplicationListener{
37-
public void init(){
38-
Log.infoTag("MindustryX", "Hooks.init");
39-
}
40-
+
41-
+ private static void registerBundle(){
42-
+ //MDTX: bundle overwrite
43-
+ try{
44-
+ I18NBundle originBundle = Core.bundle;
45-
+ Fi handle = Core.files.internal("bundles/bundle-mdtx");
46-
+ Core.bundle = I18NBundle.createBundle(handle, Locale.getDefault());
47-
+ Reflect.set(Core.bundle, "locale", originBundle.getLocale());
48-
+ Log.info("MDTX: bundle has been loaded.");
49-
+ var rootBundle = Core.bundle;
50-
+ while(rootBundle.getParent() != null){
51-
+ rootBundle = rootBundle.getParent();
52-
+ }
53-
+ Reflect.set(rootBundle, "parent", originBundle);
54-
+ }catch(Throwable e){
55-
+ Log.err(e);
56-
+ }
57-
+ }
58-
}

patches/client/0008-API-add-SendPacketEvent.patch

+3-44
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ Date: Fri, 23 Jun 2023 16:18:22 +0800
44
Subject: [PATCH] API: add SendPacketEvent
55

66
---
7-
core/src/mindustry/net/ArcNetProvider.java | 3 ++
8-
core/src/mindustry/net/Net.java | 6 +++-
9-
.../mindustryX/events/SendPacketEvent.java | 33 +++++++++++++++++++
10-
3 files changed, 41 insertions(+), 1 deletion(-)
11-
create mode 100644 core/src/mindustryX/events/SendPacketEvent.java
7+
core/src/mindustry/net/ArcNetProvider.java | 3 +++
8+
core/src/mindustry/net/Net.java | 6 +++++-
9+
2 files changed, 8 insertions(+), 1 deletion(-)
1210

1311
diff --git a/core/src/mindustry/net/ArcNetProvider.java b/core/src/mindustry/net/ArcNetProvider.java
1412
index e7a1a33dd6b4a523900d841d08246d0383ce2f30..23e8b294d646f2835750a1b085ae826032c3c627 100644
@@ -72,42 +70,3 @@ index 145238bf8856c7b83da468b89362c3d1df5d5928..7db098b1985ea7df7516f43ab4b0c49f
7270
con.send(object, reliable);
7371
}
7472
}
75-
diff --git a/core/src/mindustryX/events/SendPacketEvent.java b/core/src/mindustryX/events/SendPacketEvent.java
76-
new file mode 100644
77-
index 0000000000000000000000000000000000000000..11e0817d8d2f2fc95cb40027660372f6662b9b6b
78-
--- /dev/null
79-
+++ b/core/src/mindustryX/events/SendPacketEvent.java
80-
@@ -0,0 +1,33 @@
81-
+package mindustryX.events;
82-
+
83-
+import arc.*;
84-
+import arc.util.*;
85-
+import mindustry.net.*;
86-
+import mindustryX.*;
87-
+
88-
+@MindustryXApi
89-
+public class SendPacketEvent{
90-
+ /** null for all, may emit again */
91-
+ @Nullable
92-
+ public NetConnection con;
93-
+ /** only when call in sendExcept */
94-
+ @Nullable
95-
+ public NetConnection except;
96-
+ public Object packet;
97-
+ public boolean isCancelled;
98-
+
99-
+ private SendPacketEvent(){
100-
+ }
101-
+
102-
+ private static final SendPacketEvent inst = new SendPacketEvent();
103-
+
104-
+ /** @return isCancelled */
105-
+ public static boolean emit(@Nullable NetConnection con, @Nullable NetConnection except, Object packet){
106-
+ inst.isCancelled = false;
107-
+ inst.con = con;
108-
+ inst.except = except;
109-
+ inst.packet = packet;
110-
+ Events.fire(inst);
111-
+ return inst.isCancelled;
112-
+ }
113-
+}

patches/client/0011-API-add-LogicAssembledEvent.patch

+4-33
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ Date: Thu, 3 Aug 2023 12:20:38 +0800
44
Subject: [PATCH] API: add LogicAssembledEvent
55

66
---
7-
core/src/mindustry/logic/LParser.java | 4 +++-
8-
core/src/mindustry/logic/LStatements.java | 11 ++++++++++
9-
.../world/blocks/logic/LogicBlock.java | 4 ++++
10-
.../events/LogicAssembledEvent.java | 21 +++++++++++++++++++
11-
4 files changed, 39 insertions(+), 1 deletion(-)
12-
create mode 100644 core/src/mindustryX/events/LogicAssembledEvent.java
7+
core/src/mindustry/logic/LParser.java | 4 +++-
8+
core/src/mindustry/logic/LStatements.java | 11 +++++++++++
9+
core/src/mindustry/world/blocks/logic/LogicBlock.java | 4 ++++
10+
3 files changed, 18 insertions(+), 1 deletion(-)
1311

1412
diff --git a/core/src/mindustry/logic/LParser.java b/core/src/mindustry/logic/LParser.java
1513
index 6f65e9981f2291d1c892c23f3ec8603aec8e3a4c..32133826223d3e4fe1be991c8abd3bc23d720779 100644
@@ -90,30 +88,3 @@ index b0af04af3eb5311bee7ef27fa0208f99d23d7894..12cda95f81156b8b5ce60d3ab97aa6db
9088
executor.load(asm);
9189
}catch(Exception e){
9290
//handle malformed code and replace it with nothing
93-
diff --git a/core/src/mindustryX/events/LogicAssembledEvent.java b/core/src/mindustryX/events/LogicAssembledEvent.java
94-
new file mode 100644
95-
index 0000000000000000000000000000000000000000..4db97d52e70a6cd0b53346d86461b3677da44138
96-
--- /dev/null
97-
+++ b/core/src/mindustryX/events/LogicAssembledEvent.java
98-
@@ -0,0 +1,21 @@
99-
+package mindustryX.events;
100-
+
101-
+import mindustry.logic.*;
102-
+import mindustry.world.blocks.logic.LogicBlock.*;
103-
+import mindustryX.*;
104-
+
105-
+/**
106-
+ * Fired after LAssembler finish assemble and about to load to LExecutor
107-
+ * Allow mods to modify LAssembler, try parse InvalidStatement again.
108-
+ * Not fired when LogicBlock load empty code.
109-
+ */
110-
+@MindustryXApi
111-
+public class LogicAssembledEvent{
112-
+ public LogicBuild build;
113-
+ public LAssembler assembler;
114-
+
115-
+ public LogicAssembledEvent(LogicBuild build, LAssembler assembler){
116-
+ this.build = build;
117-
+ this.assembler = assembler;
118-
+ }
119-
+}

patches/client/0014-API-Hooks-onHttp.patch

-39
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,3 @@ From: way-zer <[email protected]>
33
Date: Tue, 9 Apr 2024 18:23:19 +0800
44
Subject: [PATCH] API(Hooks) onHttp
55

6-
---
7-
core/src/mindustryX/Hooks.java | 17 +++++++++++++++++
8-
1 file changed, 17 insertions(+)
9-
10-
diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java
11-
index ca6144798666f96ee074838e489b51df1a10d19d..7cace088409de5b701577465f38ae01eb8b87a1c 100644
12-
--- a/core/src/mindustryX/Hooks.java
13-
+++ b/core/src/mindustryX/Hooks.java
14-
@@ -4,6 +4,7 @@ import arc.*;
15-
import arc.files.*;
16-
import arc.util.*;
17-
18-
+import java.net.*;
19-
import java.util.*;
20-
21-
public class Hooks implements ApplicationListener{
22-
@@ -19,6 +20,22 @@ public class Hooks implements ApplicationListener{
23-
Log.infoTag("MindustryX", "Hooks.init");
24-
}
25-
26-
+ @SuppressWarnings("unused")//call before arc.util.Http$HttpRequest.block
27-
+ public static void onHttp(Http.HttpRequest req){
28-
+ if(Core.settings.getBool("githubMirror")){
29-
+ try{
30-
+ String url = req.url;
31-
+ String host = new URL(url).getHost();
32-
+ if(host.contains("github.com") || host.contains("raw.githubusercontent.com")){
33-
+ url = "https://gh.tinylake.tech/" + url;
34-
+ req.url = url;
35-
+ }
36-
+ }catch(Exception e){
37-
+ //ignore
38-
+ }
39-
+ }
40-
+ }
41-
+
42-
private static void registerBundle(){
43-
//MDTX: bundle overwrite
44-
try{

patches/client/0015-API-RenderExt.patch

+3-62
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ Date: Tue, 26 Mar 2024 19:22:00 +0800
44
Subject: [PATCH] API: RenderExt
55

66
---
7-
core/src/mindustry/core/Renderer.java | 3 ++-
8-
.../src/mindustry/graphics/BlockRenderer.java | 3 ++-
9-
core/src/mindustryX/Hooks.java | 5 ++++
10-
core/src/mindustryX/features/RenderExt.java | 27 +++++++++++++++++++
11-
4 files changed, 36 insertions(+), 2 deletions(-)
12-
create mode 100644 core/src/mindustryX/features/RenderExt.java
7+
core/src/mindustry/core/Renderer.java | 3 ++-
8+
core/src/mindustry/graphics/BlockRenderer.java | 3 ++-
9+
2 files changed, 4 insertions(+), 2 deletions(-)
1310

1411
diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java
1512
index ae3ae07e384731434e66a31ee13bfaa1576a83a8..01b2872b6ab744ad12f44049feb6146ce8ad84d5 100644
@@ -53,59 +50,3 @@ index aec39b666137666976321336b698e80177b05f84..5c57b1309660e500c38099d362b46a62
5350
Draw.reset();
5451
Draw.z(Layer.block);
5552

56-
diff --git a/core/src/mindustryX/Hooks.java b/core/src/mindustryX/Hooks.java
57-
index 7cace088409de5b701577465f38ae01eb8b87a1c..1548f3d6ae0d362575a05ef38ea1575af65f5afc 100644
58-
--- a/core/src/mindustryX/Hooks.java
59-
+++ b/core/src/mindustryX/Hooks.java
60-
@@ -3,6 +3,8 @@ package mindustryX;
61-
import arc.*;
62-
import arc.files.*;
63-
import arc.util.*;
64-
+import mindustry.*;
65-
+import mindustryX.features.*;
66-
67-
import java.net.*;
68-
import java.util.*;
69-
@@ -18,6 +20,9 @@ public class Hooks implements ApplicationListener{
70-
@Override
71-
public void init(){
72-
Log.infoTag("MindustryX", "Hooks.init");
73-
+ if(!Vars.headless){
74-
+ RenderExt.init();
75-
+ }
76-
}
77-
78-
@SuppressWarnings("unused")//call before arc.util.Http$HttpRequest.block
79-
diff --git a/core/src/mindustryX/features/RenderExt.java b/core/src/mindustryX/features/RenderExt.java
80-
new file mode 100644
81-
index 0000000000000000000000000000000000000000..835b5d7b801f03683cbb7502ea98025ff2c24d40
82-
--- /dev/null
83-
+++ b/core/src/mindustryX/features/RenderExt.java
84-
@@ -0,0 +1,27 @@
85-
+package mindustryX.features;
86-
+
87-
+import arc.*;
88-
+import arc.util.*;
89-
+import mindustry.game.EventType.*;
90-
+import mindustry.gen.*;
91-
+import mindustry.world.*;
92-
+
93-
+public class RenderExt{
94-
+ public static void init(){
95-
+ Events.run(Trigger.preDraw, () -> {
96-
+ });
97-
+ Events.run(Trigger.draw, RenderExt::draw);
98-
+ }
99-
+
100-
+ private static void draw(){
101-
+
102-
+ }
103-
+
104-
+ public static void onGroupDraw(Drawc t){
105-
+ t.draw();
106-
+ }
107-
+
108-
+ public static void onBlockDraw(Tile tile, Block block, @Nullable Building build){
109-
+ block.drawBase(tile);
110-
+ }
111-
+}

0 commit comments

Comments
 (0)