Skip to content

Commit a13a2ce

Browse files
authored
Merge pull request #23 from Polyfrost/refactor/clean-up
Clean up entire project
2 parents 30ef556 + 9c3651d commit a13a2ce

Some content is hidden

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

44 files changed

+958
-871
lines changed

build.gradle.kts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ repositories {
2323

2424
toolkitLoomHelper {
2525
useOneConfig {
26-
version = "1.0.0-alpha.151"
26+
version = "1.0.0-alpha.176"
2727
loaderVersion = "1.1.0-alpha.53"
2828

2929
usePolyMixin = true
30-
polyMixinVersion = "0.8.4+build.2"
30+
polyMixinVersion = "0.8.4+build.7"
3131

3232
applyLoaderTweaker = true
3333

@@ -37,7 +37,7 @@ toolkitLoomHelper {
3737
}
3838

3939
useDevAuth("1.2.1")
40-
useMixinExtras("0.4.1")
40+
useMixinExtras("0.5.0")
4141

4242
// Turns off the server-side run configs, as we're building a client-sided mod.
4343
disableRunConfigs(GameSide.SERVER)
@@ -54,6 +54,16 @@ toolkitLoomHelper {
5454
}
5555

5656
dependencies {
57+
implementation(libs.discord.game.sdk4j)
58+
includeOrShade(libs.discord.game.sdk4j)
59+
60+
implementation(libs.bundles.ktor.client)
61+
includeOrShade(libs.bundles.ktor.client)
62+
implementation(libs.bundles.ktor.server)
63+
includeOrShade(libs.bundles.ktor.server)
64+
implementation(libs.bundles.ktor.serialization)
65+
includeOrShade(libs.bundles.ktor.serialization)
66+
5767
// Add (Legacy) Fabric API as dependencies (these are both optional but are particularly useful).
5868
if (mcData.isFabric) {
5969
if (mcData.isLegacyFabric) {
@@ -64,22 +74,4 @@ dependencies {
6474
modImplementation("net.fabricmc.fabric-api:fabric-api:${mcData.dependencies.fabric.fabricApiVersion}")
6575
}
6676
}
67-
modImplementation("com.github.JnCrMx:discord-game-sdk4j:v0.5.5")
68-
69-
implementation("io.ktor:ktor-client-core:3.3.1")
70-
shade("io.ktor:ktor-client-core:3.3.1")
71-
implementation("io.ktor:ktor-client-cio:3.3.1")
72-
shade("io.ktor:ktor-client-cio:3.3.1")
73-
implementation("io.ktor:ktor-client-content-negotiation:3.3.1")
74-
shade("io.ktor:ktor-client-content-negotiation:3.3.1")
75-
implementation("io.ktor:ktor-serialization-kotlinx-json:3.3.1")
76-
shade("io.ktor:ktor-serialization-kotlinx-json:3.3.1")
77-
implementation("io.ktor:ktor-server-websockets:3.3.1")
78-
shade("io.ktor:ktor-server-websockets:3.3.1")
79-
}
80-
81-
tasks {
82-
named("build") {
83-
dependsOn("fatJar")
84-
}
8577
}

gradle/libs.versions.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[versions]
2+
discord-game-sdk4j = "v0.5.5"
3+
ktor = "3.3.1"
4+
5+
[libraries]
6+
discord-game-sdk4j = { group = "com.github.JnCrMx", name = "discord-game-sdk4j", version.ref = "discord-game-sdk4j" }
7+
ktor-client-core = { group = "io.ktor", name = "ktor-client-core", version.ref = "ktor" }
8+
ktor-client-cio = { group = "io.ktor", name = "ktor-client-cio", version.ref = "ktor" }
9+
ktor-client-content-negotiation = { group = "io.ktor", name = "ktor-client-content-negotiation", version.ref = "ktor" }
10+
ktor-server-websockets = { group = "io.ktor", name = "ktor-server-websockets", version.ref = "ktor" }
11+
ktor-serialization-kotlinx-json = { group = "io.ktor", name = "ktor-serialization-kotlinx-json", version.ref = "ktor" }
12+
13+
[bundles]
14+
ktor-client = ["ktor-client-core", "ktor-client-cio", "ktor-client-content-negotiation"]
15+
ktor-server = ["ktor-server-websockets"]
16+
ktor-serialization = ["ktor-serialization-kotlinx-json"]

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pluginManagement {
2525
plugins {
2626
kotlin("jvm") version("2.2.10")
2727
kotlin("plugin.serialization") version("2.2.10")
28-
id("dev.deftu.gradle.multiversion-root") version("2.51.0")
28+
id("dev.deftu.gradle.multiversion-root") version("2.62.0")
2929
}
3030
}
3131

src/main/java/org/polyfrost/polyplus/client/mixin/Mixin_ReplaceCapeTexture.java

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,23 @@
33
import com.mojang.authlib.GameProfile;
44
import net.minecraft.client.network.NetworkPlayerInfo;
55
import net.minecraft.util.ResourceLocation;
6-
import org.polyfrost.polyplus.PolyPlus;
6+
import org.polyfrost.polyplus.client.cosmetics.CosmeticManager;
77
import org.spongepowered.asm.mixin.Final;
88
import org.spongepowered.asm.mixin.Mixin;
99
import org.spongepowered.asm.mixin.Shadow;
10+
import org.spongepowered.asm.mixin.injection.At;
1011
import org.spongepowered.asm.mixin.injection.Inject;
1112
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
1213

13-
import static org.polyfrost.polyplus.network.plus.cache.CosmeticCache.getCosmetic;
14-
1514
@Mixin(NetworkPlayerInfo.class)
1615
public class Mixin_ReplaceCapeTexture {
17-
@Shadow
18-
private ResourceLocation locationCape;
19-
20-
@Shadow @Final
21-
private GameProfile gameProfile;
16+
@Shadow @Final private GameProfile gameProfile;
2217

23-
@Inject(method = "getLocationCape", at = @org.spongepowered.asm.mixin.injection.At("HEAD"))
24-
private void polyplus$onGetCape(CallbackInfoReturnable<ResourceLocation> cir) {
25-
ResourceLocation cape = getCosmetic(gameProfile.getId(), "cape");
26-
if (cape != null) {
27-
System.out.println("Replacing cape for " + gameProfile.getName() + " with " + cape);
28-
this.locationCape = cape;
29-
} else {
30-
System.out.println("No cape found for " + gameProfile.getName());
18+
@Inject(method = "getLocationCape", at = @At("HEAD"))
19+
private void polyplus$useCustomCape(CallbackInfoReturnable<ResourceLocation> cir) {
20+
ResourceLocation capeLocation = CosmeticManager.get(this.gameProfile.getId(), "cape");
21+
if (capeLocation != null) {
22+
cir.setReturnValue(capeLocation);
3123
}
3224
}
3325
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.polyfrost.polyplus
2+
3+
enum class BackendUrl(val url: String) {
4+
PRODUCTION("https://plus.polyfrost.org"),
5+
STAGING("https://plus-staging.polyfrost.org"),
6+
LOCAL("http://localhost:8080");
7+
8+
operator fun plus(other: String): String {
9+
return this + other
10+
}
11+
12+
override fun toString(): String {
13+
return url
14+
}
15+
}

src/main/kotlin/org/polyfrost/polyplus/Example.kt

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

src/main/kotlin/org/polyfrost/polyplus/PolyPlus.kt

Lines changed: 0 additions & 176 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package org.polyfrost.polyplus
2+
3+
object PolyPlusConstants {
4+
// Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin.
5+
const val ID = "@MOD_ID@"
6+
const val NAME = "@MOD_NAME@"
7+
const val VERSION = "@MOD_VERSION@"
8+
}

0 commit comments

Comments
 (0)