Skip to content

Commit be1ba51

Browse files
authored
Merge pull request #41 from MoSadie/2.3.0-effects
2.3.0 Effects
2 parents 1e88846 + 7c9e215 commit be1ba51

116 files changed

Lines changed: 4993 additions & 143 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313

1414
# Setup JDK
1515
- name: Set up JDK 8
16-
uses: actions/setup-java@v3
16+
uses: actions/setup-java@v4
1717
with:
1818
distribution: adopt
1919
java-version: 8
20-
cache: 'gradle'
20+
21+
- name: Set up Gradle
22+
uses: gradle/gradle-build-action@v2
2123

2224
# Build Core
2325
- name: Build/Install Core
@@ -48,15 +50,17 @@ jobs:
4850

4951
steps:
5052
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
51-
- uses: actions/checkout@v2
53+
- uses: actions/checkout@v4
5254

5355
# Setup JDK
5456
- name: Set up JDK 8
55-
uses: actions/setup-java@v3
57+
uses: actions/setup-java@v4
5658
with:
5759
distribution: adopt
5860
java-version: 8
59-
cache: 'gradle'
61+
62+
- name: Set up Gradle
63+
uses: gradle/gradle-build-action@v2
6064

6165
# Download Core
6266
- name: Download Core Artifact
@@ -77,7 +81,7 @@ jobs:
7781

7882
# Upload Artifact
7983
- name: Upload Artifact
80-
uses: actions/upload-artifact@v2
84+
uses: actions/upload-artifact@v3
8185
with:
8286
name: ${{ matrix.mod-loader }} ${{ matrix.mc-version }}
8387
path: ./MinecraftMod/${{ matrix.mod-loader }}/${{ matrix.mc-version }}/build/libs/*.jar
@@ -92,14 +96,14 @@ jobs:
9296
fail-fast: false
9397
matrix:
9498
mod-loader: ['fabric', 'forge']
95-
mc-version: ['1.17.1', '1.18.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1']
99+
mc-version: ['1.17.1', '1.18.1', '1.18.2', '1.19', '1.19.2', '1.19.3', '1.19.4', '1.20.1', "1.20.2"]
96100
#exclude:
97101
# - mod-loader: 'forge'
98102
# mc-version: '1.17'
99103

100104
steps:
101105
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
102-
- uses: actions/checkout@v2
106+
- uses: actions/checkout@v4
103107

104108
# # Setup JDK
105109
# - name: Set up JDK 1.8
@@ -115,11 +119,13 @@ jobs:
115119

116120
# Setup JDK
117121
- name: Set up JDK 1.17
118-
uses: actions/setup-java@v3
122+
uses: actions/setup-java@v4
119123
with:
120124
distribution: 'adopt'
121125
java-version: 17
122-
cache: 'gradle'
126+
127+
- name: Set up Gradle
128+
uses: gradle/gradle-build-action@v2
123129

124130
# Download Core
125131
- name: Download Core Artifact
@@ -135,7 +141,7 @@ jobs:
135141

136142
# Upload Artifact
137143
- name: Upload Artifact
138-
uses: actions/upload-artifact@v2
144+
uses: actions/upload-artifact@v3
139145
with:
140146
name: ${{ matrix.mod-loader }} ${{ matrix.mc-version }}
141147
path: ./MinecraftMod/${{ matrix.mod-loader }}/${{ matrix.mc-version }}/build/libs/*.jar
@@ -147,7 +153,7 @@ jobs:
147153

148154
steps:
149155
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
150-
- uses: actions/checkout@v2
156+
- uses: actions/checkout@v4
151157

152158
# # Setup JDK
153159
# - name: Set up JDK 1.8
@@ -163,11 +169,13 @@ jobs:
163169

164170
# Setup JDK
165171
- name: Set up JDK 16
166-
uses: actions/setup-java@v3
172+
uses: actions/setup-java@v4
167173
with:
168174
distribution: microsoft
169175
java-version: 16
170-
cache: 'gradle'
176+
177+
- name: Set up Gradle
178+
uses: gradle/gradle-build-action@v2
171179

172180
# Download Core
173181
- name: Download Core Artifact
@@ -190,7 +198,7 @@ jobs:
190198

191199
# Upload Artifact
192200
- name: Upload Artifact
193-
uses: actions/upload-artifact@v2
201+
uses: actions/upload-artifact@v3
194202
with:
195203
name: Stream Deck Plugin
196204
path: ./StreamDeckPlugin/*.streamDeckPlugin

MinecraftMod/core/.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MinecraftMod/core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'maven-publish'
44
}
55

6-
version = 2.2
6+
version = 2.3
77
group = 'com.mosadie.effectmc'
88
archivesBaseName = "EffectMC-Core"
99

MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/EffectExecutor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public interface EffectExecutor {
3232

3333
boolean showToast(String title, String subtitle);
3434

35+
boolean showItemToast(String itemData, String title, String subtitle);
36+
3537
boolean openBook(JsonObject bookJSON);
3638

3739
boolean narrate(String message, boolean interrupt);
@@ -56,5 +58,9 @@ public interface EffectExecutor {
5658

5759
boolean setRenderDistance(int chunks);
5860

59-
// boolean setGamemode(SetGamemodeHandler.GAMEMODE gamemode);
61+
WorldState getWorldState();
62+
63+
String getSPWorldName();
64+
65+
String getServerIP();
6066
}

MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/EffectMCCore.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public EffectMCCore(File configFile, File trustFile, EffectExecutor executor) {
6161
effects.add(new SetGameModeHandler(this));
6262
effects.add(new ChatVisibilityHandler(this));
6363
effects.add(new SetRenderDistanceHandler(this));
64+
effects.add(new RejoinHandler(this));
65+
effects.add(new ShowItemToastHandler(this));
6466
}
6567

6668
@SuppressWarnings("unused")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.mosadie.effectmc.core;
2+
3+
public enum WorldState {
4+
MULTIPLAYER,
5+
SINGLEPLAYER,
6+
OTHER
7+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.mosadie.effectmc.core.handler;
2+
3+
import com.mosadie.effectmc.core.EffectMCCore;
4+
5+
public class RejoinHandler extends EffectRequestHandler {
6+
public RejoinHandler(EffectMCCore core) {
7+
super(core);
8+
}
9+
10+
@Override
11+
public String getEffectName() {
12+
return "Rejoin";
13+
}
14+
15+
@Override
16+
public String getEffectTooltip() {
17+
return "Disconnects and rejoins the current server/world.";
18+
}
19+
20+
@Override
21+
EffectResult execute() {
22+
switch (core.getExecutor().getWorldState()) {
23+
case MULTIPLAYER:
24+
String server = core.getExecutor().getServerIP();
25+
if (core.getExecutor().joinServer(server))
26+
return new EffectResult("Rejoining server...", true);
27+
else
28+
return new EffectResult("Something went wrong rejoining server.", false);
29+
30+
case SINGLEPLAYER:
31+
String world = core.getExecutor().getSPWorldName();
32+
if (core.getExecutor().loadWorld(world))
33+
return new EffectResult("Rejoining world...", true);
34+
else
35+
return new EffectResult("Something went wrong rejoining world.", false);
36+
37+
default:
38+
return new EffectResult("Not currently in a world/server!", false);
39+
}
40+
}
41+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package com.mosadie.effectmc.core.handler;
2+
3+
import com.mosadie.effectmc.core.EffectMCCore;
4+
5+
public class ShowItemToastHandler extends EffectRequestHandler {
6+
7+
public ShowItemToastHandler(EffectMCCore core) {
8+
super(core);
9+
addCommentProperty("You can get item data by holding an item and running /effectmc exportitem");
10+
addStringProperty("item", "", true, "Item Data", "{}");
11+
addCommentProperty("Set color using § color codes.");
12+
addStringProperty("title", "", true, "Title", "Hello");
13+
addStringProperty("subtitle", "", true, "Subtitle", "World!");
14+
addCommentProperty("For a blank subtitle, use a single space.");
15+
}
16+
17+
@Override
18+
public String getEffectName() {
19+
return "Show Item Toast";
20+
}
21+
22+
@Override
23+
public String getEffectTooltip() {
24+
return "Show a toast on screen with a custom message and item.";
25+
}
26+
27+
@Override
28+
EffectResult execute() {
29+
core.getExecutor().log("Showing item toast with data: " + getProperty("item").getAsString() + " title: " + getProperty("title").getAsString() + " Subtitle: " + getProperty("subtitle").getAsString());
30+
if (core.getExecutor().showItemToast(getProperty("item").getAsString(), getProperty("title").getAsString(), getProperty("subtitle").getAsString()))
31+
return new EffectResult("Showing item toast with data: " + getProperty("item").getAsString() + " title: " + getProperty("title").getAsString() + " Subtitle: " + getProperty("subtitle").getAsString(), true);
32+
else
33+
return new EffectResult("Failed to show toast.", false);
34+
35+
}
36+
}

MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/property/FloatProperty.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public String getAsString() {
3434

3535
@Override
3636
public String getHTMLInput() {
37-
return "<label for=\""+ id + "\">" + getLabel() + "</label><input type=\"range\" id=\"" + id + "\" name=\"" + id + "\" value=\"" + getAsString() + "\" min=\"" + min + "\" max=\"" + max + "\" step=\"0.01\">";
37+
return "<label for=\""+ id + "\">" + getLabel() + "</label><input type=\"number\" id=\"" + id + "\" name=\"" + id + "\" value=\"" + getAsString() + "\" min=\"" + min + "\" max=\"" + max + "\" step=\"0.01\">";
3838
}
3939

4040
@Override

MinecraftMod/fabric/1.16.4/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id 'fabric-loom' version '0.6-SNAPSHOT'
2+
id 'fabric-loom' version '0.7-SNAPSHOT'
33
id 'maven-publish'
44
}
55

0 commit comments

Comments
 (0)