Skip to content

Commit cb873cc

Browse files
committed
feat: add dimensions checkpoints
1 parent 43861d5 commit cb873cc

3 files changed

Lines changed: 57 additions & 43 deletions

File tree

src/main/java/zadudoder/spmhelper/tutorial/ParticleManager.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,21 @@ public static void registerParticleManager() {
2222

2323
BlockPos deletePos = null;
2424
for (int index = 0; index < TutorialManager.checkpoints.size(); index++) {
25-
BlockPos checkpointPosition = TutorialManager.checkpoints.get(index).pos;
25+
TutorialPoint checkpoint = TutorialManager.checkpoints.get(index);
26+
if (checkpoint.world != world.getRegistryKey()) {
27+
continue;
28+
}
2629
ParticleEffect particleEffect = ParticleTypes.END_ROD;
27-
if (TutorialManager.checkpoints.get(index).last) {
30+
if (checkpoint.last) {
2831
particleEffect = ParticleTypes.FLAME;
2932
}
3033
world.addParticle(
3134
particleEffect,
32-
checkpointPosition.getX() + 0.5, checkpointPosition.getY(), checkpointPosition.getZ() + 0.5,
35+
checkpoint.pos.getX() + 0.5, checkpoint.pos.getY(), checkpoint.pos.getZ() + 0.5,
3336
0, 0.1, 0
3437
);
35-
if (Misc.getDistance(player.getBlockPos(), checkpointPosition) <= 1) {
36-
deletePos = checkpointPosition;
38+
if (Misc.getDistance(player.getBlockPos(), checkpoint.pos) <= 1) {
39+
deletePos = checkpoint.pos;
3740
}
3841
}
3942
if (deletePos == null) {

src/main/java/zadudoder/spmhelper/tutorial/TutorialManager.java

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import net.minecraft.client.MinecraftClient;
44
import net.minecraft.text.Text;
5+
import net.minecraft.world.World;
56

67
import java.util.ArrayList;
78

@@ -19,17 +20,24 @@ public static void startTutorial() {
1920

2021
public static void stopTutorial() {
2122
isEnabled = false;
23+
checkpoints.clear();
24+
}
25+
26+
public static void skipTutorial() {
27+
Runnable action = checkpoints.getLast().action;
28+
checkpoints.clear();
29+
action.run();
2230
}
2331

2432
private static void pullText(String text) {
2533
MinecraftClient.getInstance().player.sendMessage(Text.literal(text));
2634
}
2735

28-
private static void StartTutorial(){
29-
checkpoints.add(new TutorialPoint(18, 81, 16,null, false));
30-
checkpoints.add(new TutorialPoint(14, 81, 22,null, false));
31-
checkpoints.add(new TutorialPoint(11, 81, 28,null, false));
32-
checkpoints.add(new TutorialPoint((int) 7.5, 81, 33, TutorialManager::PNAction, true));
36+
private static void StartTutorial() {
37+
checkpoints.add(new TutorialPoint(18, 81, 16, World.OVERWORLD, null, false));
38+
checkpoints.add(new TutorialPoint(14, 81, 22, World.OVERWORLD, null, false));
39+
checkpoints.add(new TutorialPoint(11, 81, 28, World.OVERWORLD, null, false));
40+
checkpoints.add(new TutorialPoint((int) 7.5, 81, 33, World.OVERWORLD, TutorialManager::PNAction, true));
3341
}
3442

3543
private static void PNAction() {
@@ -38,14 +46,14 @@ private static void PNAction() {
3846
}
3947

4048
private static void startBankTutorial() {
41-
checkpoints.add(new TutorialPoint(10, 81, 30, null, false));
42-
checkpoints.add(new TutorialPoint(6, 81, 23, null, false));
43-
checkpoints.add(new TutorialPoint(0, 81, 19, null, false));
44-
checkpoints.add(new TutorialPoint(-7, 81, 16, null, false));
45-
checkpoints.add(new TutorialPoint(-16, 79, 16, null, false));
46-
checkpoints.add(new TutorialPoint(-24, 79, 12, null, false));
47-
checkpoints.add(new TutorialPoint(-32, 78, 8, null, false));
48-
checkpoints.add(new TutorialPoint(-36, 79, 14, TutorialManager::BankAction, true));
49+
checkpoints.add(new TutorialPoint(10, 81, 30, World.OVERWORLD, null, false));
50+
checkpoints.add(new TutorialPoint(6, 81, 23, World.OVERWORLD, null, false));
51+
checkpoints.add(new TutorialPoint(0, 81, 19, World.OVERWORLD, null, false));
52+
checkpoints.add(new TutorialPoint(-7, 81, 16, World.OVERWORLD, null, false));
53+
checkpoints.add(new TutorialPoint(-16, 79, 16, World.OVERWORLD, null, false));
54+
checkpoints.add(new TutorialPoint(-24, 79, 12, World.OVERWORLD, null, false));
55+
checkpoints.add(new TutorialPoint(-32, 78, 8, World.OVERWORLD, null, false));
56+
checkpoints.add(new TutorialPoint(-36, 79, 14, World.OVERWORLD, TutorialManager::BankAction, true));
4957
}
5058

5159
private static void BankAction() {
@@ -54,9 +62,9 @@ private static void BankAction() {
5462
}
5563

5664
private static void startCIKTutorial() {
57-
checkpoints.add(new TutorialPoint(-33, 79, 9, null, false));
58-
checkpoints.add(new TutorialPoint(-32, 78, 2, null, false));
59-
checkpoints.add(new TutorialPoint(-31, 78, -8, TutorialManager::CIKAction, true));
65+
checkpoints.add(new TutorialPoint(-33, 79, 9, World.OVERWORLD, null, false));
66+
checkpoints.add(new TutorialPoint(-32, 78, 2, World.OVERWORLD, null, false));
67+
checkpoints.add(new TutorialPoint(-31, 78, -8, World.OVERWORLD, TutorialManager::CIKAction, true));
6068
}
6169

6270
private static void CIKAction() {
@@ -65,26 +73,26 @@ private static void CIKAction() {
6573
}
6674

6775
private static void startGalleryTutorial() {
68-
checkpoints.add(new TutorialPoint(-31, 78, -17,null, false));
69-
checkpoints.add(new TutorialPoint(-30, 78, -26,null, false));
70-
checkpoints.add(new TutorialPoint(-29, 75, -34,null, false));
71-
checkpoints.add(new TutorialPoint(-24, 73, -41,null, false));
72-
checkpoints.add(new TutorialPoint(-17, 72, -48,null, false));
73-
checkpoints.add(new TutorialPoint(-10, 72, -56,null, false));
74-
checkpoints.add(new TutorialPoint(-6, 71, -63,null, false));
75-
checkpoints.add(new TutorialPoint(-3, 71, -75,null, false));
76-
checkpoints.add(new TutorialPoint(2, 70, -81,null, false));
77-
checkpoints.add(new TutorialPoint(11, 70, -88,null, false));
78-
checkpoints.add(new TutorialPoint(20, 68, -93,null, false));
79-
checkpoints.add(new TutorialPoint(29, 64, -97,null, false));
80-
checkpoints.add(new TutorialPoint(37, 66, -104,null, false));
81-
checkpoints.add(new TutorialPoint(44, 65, -111,null, false));
82-
checkpoints.add(new TutorialPoint(54, 63, -119,null, false));
83-
checkpoints.add(new TutorialPoint(59, 63, -126,null, false));
84-
checkpoints.add(new TutorialPoint(59, 64, -139,null, false));
85-
checkpoints.add(new TutorialPoint(59, 64, -147,null, false));
86-
checkpoints.add(new TutorialPoint(59, 50, -154,null, false));
87-
checkpoints.add(new TutorialPoint(59, 50, -166, TutorialManager::GalleryAction, true));
76+
checkpoints.add(new TutorialPoint(-31, 78, -17, World.OVERWORLD, null, false));
77+
checkpoints.add(new TutorialPoint(-30, 78, -26, World.OVERWORLD, null, false));
78+
checkpoints.add(new TutorialPoint(-29, 75, -34, World.OVERWORLD, null, false));
79+
checkpoints.add(new TutorialPoint(-24, 73, -41, World.OVERWORLD, null, false));
80+
checkpoints.add(new TutorialPoint(-17, 72, -48, World.OVERWORLD, null, false));
81+
checkpoints.add(new TutorialPoint(-10, 72, -56, World.OVERWORLD, null, false));
82+
checkpoints.add(new TutorialPoint(-6, 71, -63, World.OVERWORLD, null, false));
83+
checkpoints.add(new TutorialPoint(-3, 71, -75, World.OVERWORLD, null, false));
84+
checkpoints.add(new TutorialPoint(2, 70, -81, World.OVERWORLD, null, false));
85+
checkpoints.add(new TutorialPoint(11, 70, -88, World.OVERWORLD, null, false));
86+
checkpoints.add(new TutorialPoint(20, 68, -93, World.OVERWORLD, null, false));
87+
checkpoints.add(new TutorialPoint(29, 64, -97, World.OVERWORLD, null, false));
88+
checkpoints.add(new TutorialPoint(37, 66, -104, World.OVERWORLD, null, false));
89+
checkpoints.add(new TutorialPoint(44, 65, -111, World.OVERWORLD, null, false));
90+
checkpoints.add(new TutorialPoint(54, 63, -119, World.OVERWORLD, null, false));
91+
checkpoints.add(new TutorialPoint(59, 63, -126, World.OVERWORLD, null, false));
92+
checkpoints.add(new TutorialPoint(59, 64, -139, World.OVERWORLD, null, false));
93+
checkpoints.add(new TutorialPoint(59, 64, -147, World.OVERWORLD, null, false));
94+
checkpoints.add(new TutorialPoint(59, 50, -154, World.OVERWORLD, null, false));
95+
checkpoints.add(new TutorialPoint(59, 50, -166, World.OVERWORLD, TutorialManager::GalleryAction, true));
8896
}
8997

9098
private static void GalleryAction() {
@@ -93,7 +101,7 @@ private static void GalleryAction() {
93101
}
94102

95103
private static void startLawCourtTutorial() {
96-
checkpoints.add(new TutorialPoint(-31, 78, -17, null, false));
104+
checkpoints.add(new TutorialPoint(-31, 78, -17, World.OVERWORLD, null, false));
97105
}
98106

99107
}

src/main/java/zadudoder/spmhelper/tutorial/TutorialPoint.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package zadudoder.spmhelper.tutorial;
22

3+
import net.minecraft.registry.RegistryKey;
34
import net.minecraft.util.math.BlockPos;
45

56
public class TutorialPoint {
67
public BlockPos pos;
8+
public RegistryKey<?> world;
79
public Runnable action;
810
public boolean last;
911

10-
public TutorialPoint(int x, int y, int z, Runnable action, Boolean last) {
12+
public TutorialPoint(int x, int y, int z, RegistryKey<?> world, Runnable action, Boolean last) {
1113
this.pos = new BlockPos(x, y, z);
14+
this.world = world;
1215
this.action = action;
1316
this.last = last;
1417
}

0 commit comments

Comments
 (0)