Working Release

This commit is contained in:
2025-06-05 21:05:42 -04:00
parent 4e04aada7a
commit dd78f89164
3 changed files with 76 additions and 83 deletions

View File

@@ -1,7 +1,7 @@
plugins {
id 'fabric-loom' version "${loom_version}"
id 'maven-publish'
id "org.jetbrains.kotlin.jvm" version "2.1.20"
id "org.jetbrains.kotlin.jvm" version "2.1.20" // Ensure your kotlin_version in gradle.properties matches or is compatible
}
version = project.mod_version
@@ -13,18 +13,9 @@ base {
repositories {
mavenCentral()
maven {
url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/'
}
maven {
url 'https://maven.impactdev.net/repository/development/'
}
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
maven { url 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' }
maven { url 'https://maven.impactdev.net/repository/development/' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
loom {
@@ -36,7 +27,6 @@ loom {
sourceSet sourceSets.client
}
}
}
fabricApi {
@@ -46,18 +36,25 @@ fabricApi {
}
dependencies {
// To change the versions see the gradle.properties file
// Minecraft & Fabric Loader
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
// Fabric API
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// Fabric Kotlin Language Adapter
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
// Other Mod Dependencies (e.g., Cobblemon)
modImplementation "com.cobblemon:fabric:1.6.0+1.21.1-SNAPSHOT"
// JSON and GSON dependencies - add implementation first, then include
implementation "org.json:json:20231013"
include "org.json:json:20231013"
implementation "com.google.code.gson:gson:2.10.1"
implementation "org.json:json:20231013" // Or the latest version
include "com.google.code.gson:gson:2.10.1"
}
processResources {
@@ -74,29 +71,23 @@ tasks.withType(JavaCompile).configureEach {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = 21
jvmTarget = "21" // Ensure jvmTarget is a string
}
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {
inputs.property "archivesName", project.base.archivesName
from("LICENSE") {
rename { "${it}_${inputs.properties.archivesName}"}
}
}
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
@@ -104,12 +95,7 @@ publishing {
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
// Add your publishing repositories here
}
}

View File

@@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory
object CobbleSync : ModInitializer {
private val logger = LoggerFactory.getLogger("cobblesync")
private val request = Request("http://localhost:5173")
private val request = Request("https://authserver.sirblob.co")
override fun onInitialize() {
@@ -64,27 +64,24 @@ object CobbleSync : ModInitializer {
return@Command 1
}
try {
var obj = box30.saveToJSON(JsonObject(), player.registryAccess())
val payload = JSONObject()
.put("pokemon", obj.toString())
.put("count", pokemonCount)
logger.info("/api/cobblesync/" + player.uuid.toString())
try {
var response = request.POST("/api/cobblesync/" + player.uuid.toString(), payload)
logger.info(response.toString())
if (response.getInt("status") != 200) {
player.sendSystemMessage(Component.literal("Failed to sync box 1!").red())
return@Command 1
}
player.sendSystemMessage(Component.literal("Box 1 synced successfully!").green())
player.sendSystemMessage(Component.literal("Box 30 synced successfully!").green())
} catch (e: HTTPException) {
logger.error("HTTP Exception: ${e.message}")
player.sendSystemMessage(Component.literal("Error syncing box 1!").red())
player.sendSystemMessage(Component.literal("Error syncing box 30!").red())
return@Command 1
} catch (e: Exception) {
logger.error("Exception: ${e.message}")
@@ -105,6 +102,16 @@ object CobbleSync : ModInitializer {
var box1 = pc.boxes.get(0)
var pokemonCount = 0
box1.pc.forEach({ _ ->
pokemonCount++
})
if (pokemonCount > 0) {
player.sendSystemMessage(Component.literal("[Load Failed] Box 1 is not empty!").red())
return@Command 1
}
try {
var response = request.GET("/api/cobblesync/" + player.uuid.toString())

View File

@@ -5,7 +5,7 @@
"name": "CobbleSync",
"description": "This is an example description! Tell everyone what your mod is about!",
"authors": [
"Me!"
"Sir_Blob_"
],
"contact": {
"homepage": "https://fabricmc.net/",