Skip to content

Commit

Permalink
feat: 1.20.5+ support (#13)
Browse files Browse the repository at this point in the history
* chore: Update geary, idofront, publish action

* feat: 1.20.5+ support

* refactor: edit codec instead

* fix: use packets to handle title/subtitle/actionbar with no permission checks

* fix: space-ids not being transformed

* fix: use packetlistener for inventory-titles & entity data

* fix: signs formatting minimessage and emotes

* fix: tablist footer/header parsing emotes

* fix: handle anvil renaming by escaping in client-sent RenameItem packet and transforming in server-side event

* fix: more chat client events

* fix: sign handling moved to events

* fix: anvil renaming storing original rename name for next rename

* fix: properly unescape escaped emoteids

* chore: bump idofront

* fix: emotes in chat not containing inserts

* refactor: remove old version impl

---------

Co-authored-by: Danielle Voznyy <[email protected]>
  • Loading branch information
Boy0000 and 0ffz authored May 30, 2024
1 parent 9516e4d commit 8f02e21
Show file tree
Hide file tree
Showing 30 changed files with 386 additions and 1,981 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
java-version: 21
cache: gradle

- name: Build
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: MineInAbyss/publish-action@master
- uses: MineInAbyss/publish-action@develop
with:
maven-metadata-url: https://repo.mineinabyss.com/releases/com/mineinabyss/emojy/maven-metadata.xml
pages-path: build/dokka/htmlMultiModule/
dokka: dokkaHtmlMultiModule
maven-snapshot-metadata-url: https://repo.mineinabyss.com/snapshots/com/mineinabyss/emojy/maven-metadata.xml
maven-username: ${{ secrets.MAVEN_PUBLISH_USERNAME }}
maven-password: ${{ secrets.MAVEN_PUBLISH_PASSWORD }}
release-files: |
Expand Down
51 changes: 25 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io.papermc.paperweight.userdev.ReobfArtifactConfiguration
import net.minecrell.pluginyml.paper.PaperPluginDescription

plugins {
Expand All @@ -8,40 +9,40 @@ plugins {
id("com.mineinabyss.conventions.autoversion")
id("xyz.jpenilla.run-paper") version "2.0.1" // Adds runServer and runMojangMappedServer tasks for testing
id("net.minecrell.plugin-yml.paper") version "0.6.0"
id("io.papermc.paperweight.userdev") version "1.5.11"
id("io.papermc.paperweight.userdev") version "1.7.1"
}

paperweight.reobfArtifactConfiguration.set(ReobfArtifactConfiguration.MOJANG_PRODUCTION)

allprojects {
apply(plugin = "java")

version = rootProject.version

dependencies {
compileOnly(kotlin("stdlib-jdk8"))
}

repositories {
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
maven("https://hub.jeff-media.com/nexus/repository/jeff-media-public/")
mavenLocal()
}

dependencies {
implementation("com.jeff_media:MorePersistentDataTypes:2.4.0")
}
}

dependencies {
// MineInAbyss platform
compileOnly(libs.bundles.idofront.core)
compileOnly(libs.kotlinx.serialization.json)
compileOnly(libs.kotlinx.serialization.kaml)
compileOnly(libs.kotlinx.coroutines)
compileOnly(libs.minecraft.mccoroutine)
compileOnly(idofrontLibs.bundles.idofront.core)
compileOnly(idofrontLibs.kotlinx.serialization.json)
compileOnly(idofrontLibs.kotlinx.serialization.kaml)
compileOnly(idofrontLibs.kotlinx.coroutines)
compileOnly(idofrontLibs.minecraft.mccoroutine)

// Shaded
paperweight.paperDevBundle("1.20.4-R0.1-SNAPSHOT") //NMS
paperweight.paperDevBundle("1.20.6-R0.1-SNAPSHOT") //NMS
implementation(project(path = ":core"))
implementation(project(path = ":v1_19_R1", configuration = "reobf"))
implementation(project(path = ":v1_19_R2", configuration = "reobf"))
implementation(project(path = ":v1_19_R3", configuration = "reobf"))
implementation(project(path = ":v1_20_R1", configuration = "reobf"))
implementation(project(path = ":v1_20_R2", configuration = "reobf"))
implementation(project(path = ":v1_20_R3", configuration = "reobf"))
implementation(project(path = ":v1_20_R4"))
}

tasks {
Expand All @@ -52,7 +53,7 @@ tasks {

compileJava {
options.encoding = Charsets.UTF_8.name()
options.release.set(17)
options.release.set(21)
}

javadoc {
Expand All @@ -65,16 +66,14 @@ tasks {
}

runServer {
minecraftVersion("1.20.2")
minecraftVersion("1.20.6")
}

shadowJar {
dependsOn(":v1_19_R1:reobfJar")
dependsOn(":v1_19_R2:reobfJar")
dependsOn(":v1_19_R3:reobfJar")
dependsOn(":v1_20_R1:reobfJar")
dependsOn(":v1_20_R2:reobfJar")
dependsOn(":v1_20_R3:reobfJar")
dependsOn(":v1_20_R4:reobfJar")

relocate("com.jeff_media.morepersistentdatatypes", "com.mineinabyss.shaded.morepersistentdatatypes")

archiveFileName.set("Emojy.jar")
}

Expand All @@ -88,7 +87,7 @@ paper {
val version: String by project
this.version = version
authors = listOf("boy0000")
apiVersion = "1.19"
apiVersion = "1.20"

serverDependencies {
register("Idofront") {
Expand Down
17 changes: 9 additions & 8 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ plugins {
id("com.mineinabyss.conventions.kotlin.jvm")
id("com.mineinabyss.conventions.papermc")
id("com.mineinabyss.conventions.autoversion")
alias(libs.plugins.kotlinx.serialization)
alias(idofrontLibs.plugins.kotlinx.serialization)
}

repositories {
gradlePluginPortal()
maven("https://repo.mineinabyss.com/releases")
maven("https://repo.mineinabyss.com/snapshots")
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://repo.unnamed.team/repository/unnamed-public/")
google()
}

dependencies {
// MineInAbyss platform
compileOnly(libs.bundles.idofront.core)
compileOnly(libs.kotlinx.serialization.json)
compileOnly(libs.kotlinx.serialization.kaml)
compileOnly(libs.kotlinx.coroutines)
compileOnly(libs.minecraft.mccoroutine)
compileOnly(idofrontLibs.bundles.idofront.core)
compileOnly(idofrontLibs.kotlinx.serialization.json)
compileOnly(idofrontLibs.kotlinx.serialization.kaml)
compileOnly(idofrontLibs.kotlinx.coroutines)
compileOnly(idofrontLibs.minecraft.mccoroutine)

compileOnly(libs.creative.api)
compileOnly(libs.creative.serializer.minecraft)
compileOnly(idofrontLibs.creative.api)
compileOnly(idofrontLibs.creative.serializer.minecraft)

// Shaded
implementation("com.aaaaahhhhh.bananapuncher714:GifConverter:1.0")
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/kotlin/com/mineinabyss/emojy/EmojyContext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.mineinabyss.emojy.nms.EmojyNMSHandlers
import com.mineinabyss.emojy.nms.IEmojyNMSHandler
import com.mineinabyss.emojy.translator.EmojyLanguage
import com.mineinabyss.idofront.di.DI
import com.mineinabyss.idofront.messaging.ComponentLogger

val emojy by DI.observe<EmojyContext>()
val emojyConfig by DI.observe<EmojyConfig>()
Expand All @@ -18,4 +19,5 @@ interface EmojyContext {
val gifs: Set<Gifs.Gif>
val languages: Set<EmojyLanguage>
val handler: IEmojyNMSHandler
val logger: ComponentLogger
}
6 changes: 3 additions & 3 deletions core/src/main/kotlin/com/mineinabyss/emojy/EmojyGenerator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ object EmojyGenerator {
resourcePack.font(font.toBuilder().addProvider(FontProvider.space().advance("\uE101", -1).build()).build())
// If the font has already added an entry for the emote, skip it
font.providers().any { it is BitMapFontProvider && it.file() == emote.texture } ->
return@forEach if (emojyConfig.debug) logWarn("Skipping ${emote.id}-font because it is a bitmap and already added") else {}
return@forEach emojy.logger.d("Skipping ${emote.id}-font because it is a bitmap and already added")
}

resourcePack.font(emote.appendFont(resourcePack))
emotesFolder.listFiles()?.find { f -> f.nameWithoutExtension == emote.texture.value().substringAfterLast("/").removeSuffix(".png") }?.let {
resourcePack.texture(Texture.texture(emote.texture, Writable.file(it)))
} ?: if (emojyConfig.debug) logWarn("Could not find texture for ${emote.id}") else {}
} ?: emojy.logger.d("Could not find texture for ${emote.id}")
}
emojy.gifs.forEach {
it.generateSplitGif(resourcePack)
Expand All @@ -58,7 +58,7 @@ object EmojyGenerator {
Texture.texture(Key.key("${framePath.asString()}${it.name}"), Writable.file(it))
}?.forEach(resourcePack::texture)
}.onFailure {
if (emojyConfig.debug) logError("Could not generate split gif for ${id}.gif: ${it.message}")
emojy.logger.d("Could not generate split gif for ${id}.gif: ${it.message}")
}
}
}
Loading

0 comments on commit 8f02e21

Please sign in to comment.