Skip to content

Commit 54af87c

Browse files
committed
CurseForge 1.21.1 (1.4.0)
1 parent 548f974 commit 54af87c

16 files changed

Lines changed: 115 additions & 123 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Simple Mod Sync
22

3+
> [!IMPORTANT]
4+
> **You are on the Curseforge constrained version branch**.
5+
>
6+
> Due to unwritten curseforge policies that are supposed to *"keep the platform safe"*, Simple Mod Sync cannot allow to download *any* content from *any* source.
7+
> Only content from *"verified repositories"*; Modrinth or Curseforge is allowed.
8+
> Thus this version of SMS allows downloading of files only from these domains: `forgecdn.net`, `curseforge.com`, `modrinth.com`.
9+
>
10+
> Some features, such as packed content, were also removed due to the same reason.
11+
312
A simple way to share and sync mods, resource packs, shaders, and other Minecraft content with your friends or community.
413

514
## What is Simple Mod Sync?

common/src/main/java/dev/oxydien/simpleModSync/HandlerRegistry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import dev.oxydien.simpleModSync.content.handler.ContentHandler;
66
import dev.oxydien.simpleModSync.content.handler.GameContentHandler;
77
import dev.oxydien.simpleModSync.content.handler.ModContentHandler;
8-
import dev.oxydien.simpleModSync.content.handler.PackedContentHandler;
98
import dev.oxydien.simpleModSync.modification.handler.ModificationHandler;
109
import dev.oxydien.simpleModSync.modification.handler.RemoveModificationHandler;
1110
import dev.oxydien.simpleModSync.modification.handler.RenameModificationHandler;
@@ -45,9 +44,10 @@ public void init() {
4544
this.contentHandlers.put("datapack", new GameContentHandler("datapacks"));
4645
this.contentHandlers.put("shader", new GameContentHandler("shaderpacks"));
4746

48-
ContentHandler packedContentHandler = new PackedContentHandler();
49-
this.contentHandlers.put("packed", packedContentHandler);
50-
this.contentHandlers.put("config", packedContentHandler);
47+
// "packed" and "config"
48+
//ContentHandler packedContentHandler = new PackedContentHandler();
49+
//this.contentHandlers.put("packed", packedContentHandler);
50+
//this.contentHandlers.put("config", packedContentHandler);
5151

5252
this.modificationHandlers.put("remove", new RemoveModificationHandler());
5353
this.modificationHandlers.put("rename", new RenameModificationHandler());

common/src/main/java/dev/oxydien/simpleModSync/config/Config.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,13 @@ public void setAllowGameNeedsRestartPopups(boolean allowed) {
115115
this.values.getSeenConfig().setAllowGameNeedsRestartPopups(allowed);
116116
this.save();
117117
}
118+
119+
public boolean hasVisitedCurseforgeConstraints() {
120+
return this.values.getSeenConfig().hasVisitedCurseforgeConstraints();
121+
}
122+
public void setHasVisitedCurseforgeConstraints(boolean hasVisited) {
123+
this.values.getSeenConfig().setHasVisitedCurseforgeConstraints(hasVisited);
124+
this.save();
125+
}
118126
//endregion
119127
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package dev.oxydien.simpleModSync.config;
2+
3+
import java.util.List;
4+
5+
public class RepositoryConstraints {
6+
7+
public static List<String> AllowedDomains() {
8+
return List.of("forgecdn.net", "curseforge.com", "modrinth.com");
9+
}
10+
}

common/src/main/java/dev/oxydien/simpleModSync/config/SeenConfigValues.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ public class SeenConfigValues implements IConfigCodec {
88
private static final String INIT_SCREEN_KEY = "init_screen";
99
private static final String SYNC_PROGRESS_POPUP_KEY = "allow_sync_progress_popup";
1010
private static final String NEEDS_RESTART_POPUP_KEY = "allow_needs_restart_popup";
11+
private static final String CURSEFORGE_CONSTRAINTS = "curseforge_constraints";
1112

1213
private boolean initScreen = false;
1314
private boolean allowSyncInProgressPopups = true;
1415
private boolean allowGameNeedsRestartPopups = true;
16+
private boolean curseforgeConstraints = false;
1517

1618
public static @NotNull SeenConfigValues createDefault() {
1719
return new SeenConfigValues();
@@ -22,6 +24,7 @@ public void writeTo(JsonObject parent) {
2224
parent.addProperty(INIT_SCREEN_KEY, initScreen);
2325
parent.addProperty(SYNC_PROGRESS_POPUP_KEY, allowSyncInProgressPopups);
2426
parent.addProperty(NEEDS_RESTART_POPUP_KEY, allowGameNeedsRestartPopups);
27+
parent.addProperty(CURSEFORGE_CONSTRAINTS, curseforgeConstraints);
2528
}
2629

2730
@Override
@@ -51,9 +54,18 @@ public void readFrom(JsonObject parent) {
5154
} else
5255
Log.debug(SeenConfigValues.class, NEEDS_RESTART_POPUP_KEY + " not found or invalid.");
5356

57+
var curseforgeConstraints = this.curseforgeConstraints;
58+
var curseforgeConstraintsAny = parent.get(CURSEFORGE_CONSTRAINTS);
59+
if (curseforgeConstraintsAny != null && curseforgeConstraintsAny.isJsonPrimitive()) {
60+
var curseforgeConstraintsPrimitive = curseforgeConstraintsAny.getAsJsonPrimitive();
61+
curseforgeConstraints = curseforgeConstraintsPrimitive.isBoolean() && curseforgeConstraintsPrimitive.getAsBoolean();
62+
} else
63+
Log.debug(SeenConfigValues.class, CURSEFORGE_CONSTRAINTS + " not found or invalid.");
64+
5465
this.initScreen = initScreen;
5566
this.allowSyncInProgressPopups = allowSyncInProgressPopups;
5667
this.allowGameNeedsRestartPopups = allowGameNeedsRestartPopups;
68+
this.curseforgeConstraints = curseforgeConstraints;
5769
}
5870

5971
public boolean hasVisitedInitScreen() {
@@ -65,6 +77,7 @@ public boolean isSyncInProgressPopupsAllowed() {
6577
public boolean isSyncGameNeedsRestartAllowed() {
6678
return this.allowGameNeedsRestartPopups;
6779
}
80+
public boolean hasVisitedCurseforgeConstraints() { return this.curseforgeConstraints; }
6881

6982
public void setHasVisitedInitScreen(boolean hasVisited) {
7083
this.initScreen = hasVisited;
@@ -75,4 +88,7 @@ public void setAllowSyncInProgressPopups(boolean allowed) {
7588
public void setAllowGameNeedsRestartPopups(boolean allowed) {
7689
this.allowGameNeedsRestartPopups = allowed;
7790
}
91+
public void setHasVisitedCurseforgeConstraints(boolean hasVisited) {
92+
this.curseforgeConstraints = hasVisited;
93+
}
7894
}

common/src/main/java/dev/oxydien/simpleModSync/content/ContentType.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ public enum ContentType {
55
ResourcePack,
66
ShaderPack,
77
DataPack,
8-
Packed,
9-
Config, // Same as Packed
108
}

common/src/main/java/dev/oxydien/simpleModSync/content/ContentTypeUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public static String ToString(ContentType type) {
77
case ResourcePack -> "resourcepack";
88
case ShaderPack -> "shader";
99
case DataPack -> "datapack";
10-
case Packed, Config -> "packed";
1110
};
1211
}
1312

@@ -16,7 +15,6 @@ public static ContentType FromString(String type) {
1615
case "resourcepack" -> ContentType.ResourcePack;
1716
case "datapack" -> ContentType.DataPack;
1817
case "shader" -> ContentType.ShaderPack;
19-
case "config", "packed" -> ContentType.Packed;
2018
default -> ContentType.Mod;
2119
};
2220
}

common/src/main/java/dev/oxydien/simpleModSync/content/handler/PackedContentHandler.java

Lines changed: 0 additions & 106 deletions
This file was deleted.

common/src/main/java/dev/oxydien/simpleModSync/mixin/TitleScreenMixin.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import dev.oxydien.simpleModSync.SimpleModSync;
44
import dev.oxydien.simpleModSync.config.Config;
55
import dev.oxydien.simpleModSync.ui.ProgressHelper;
6+
import dev.oxydien.simpleModSync.ui.modals.CurseforgeConstraintsModalHandler;
67
import dev.oxydien.simpleModSync.ui.screens.InitScreen;
78
import dev.oxydien.simpleModSync.ui.widgets.TotalSyncProgress;
89
import dev.oxydien.simpleModSync.ui.widgets.TotalSyncStatus;
@@ -28,6 +29,11 @@ protected TitleScreenMixin(Component title) {
2829
Minecraft.getInstance().setScreen(new InitScreen());
2930
ci.cancel();
3031
}
32+
if (!Config.instance.hasVisitedCurseforgeConstraints()) {
33+
CurseforgeConstraintsModalHandler.open(this);
34+
Config.instance.setHasVisitedCurseforgeConstraints(true);
35+
ci.cancel();
36+
}
3137
}
3238

3339
@Inject(at = @At("RETURN"), method = "init")

common/src/main/java/dev/oxydien/simpleModSync/ui/ProgressHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ private ResourceLocation getContentTypeIcon(ContentType type) {
109109
case ResourcePack -> RESOURCEPACK_ICON;
110110
case ShaderPack -> SHADER_ICON;
111111
case DataPack -> DATAPACK_ICON;
112-
case Packed, Config -> PACKED_ICON;
113112
default -> UNKNOWN_ICON;
114113
};
115114
}

0 commit comments

Comments
 (0)