Skip to content

Commit

Permalink
v2.0.4
Browse files Browse the repository at this point in the history
v2.0.4
  • Loading branch information
Apehum committed Jun 8, 2023
2 parents c32ccb3 + 114ec4f commit 92d53e4
Show file tree
Hide file tree
Showing 108 changed files with 504 additions and 328 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build
arguments: build --stacktrace

- name: Publish to GitHub
uses: Apehum/mc-publish@v1.1
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
1.19.3
1.19.4
modrinth-unfeature-mode: 'none'
modrinth-unfeature-mode: 'subset'
modrinth-id: 1bZhdhsH
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

Expand All @@ -62,7 +62,7 @@ jobs:
1.19.3
1.19.4
modrinth-unfeature-mode: 'none'
modrinth-unfeature-mode: 'subset'
modrinth-id: 1bZhdhsH
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

Expand All @@ -76,7 +76,7 @@ jobs:

changelog-file: client/changelog.md

modrinth-unfeature-mode: 'none'
modrinth-unfeature-mode: 'subset'
modrinth-id: 1bZhdhsH
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public interface ServerConnection {

Optional<VoicePlayerInfo> getClientPlayer();

void sendPacket(Packet<?> packet);
default void sendPacket(@NotNull Packet<?> packet) {
sendPacket(packet, true);
}

void sendPacket(@NotNull Packet<?> packet, boolean checkUdpConnection);

void close();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ public interface MinecraftChatHolder {

void sendMessage(@NotNull MinecraftTextComponent text);

void sendMessage(@NotNull String text);

void sendActionBar(@NotNull String text);
default void sendMessage(@NotNull String text) {
sendMessage(MinecraftTextComponent.literal(text));
}

void sendActionBar(@NotNull MinecraftTextComponent text);

default void sendActionBar(@NotNull String text) {
sendActionBar(MinecraftTextComponent.literal(text));
}

@NotNull String getLanguage();
}
4 changes: 4 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ plugins {
`kotlin-dsl`
}

dependencies {
implementation(libs.guava)
}

repositories {
mavenCentral()
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
107 changes: 107 additions & 0 deletions buildSrc/src/main/kotlin/gg/essential/util/prebundleNow.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
package gg.essential.util

import com.google.common.base.Stopwatch
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.FileCollection
import org.gradle.api.logging.Logger
import org.gradle.api.tasks.util.PatternFilterable
import org.gradle.api.tasks.util.PatternSet
import java.io.File
import java.io.OutputStream
import java.security.MessageDigest
import java.util.*
import java.util.jar.JarOutputStream
import java.util.zip.ZipEntry

val CONSTANT_TIME_FOR_ZIP_ENTRIES = GregorianCalendar(1980, Calendar.FEBRUARY, 1, 0, 0, 0).timeInMillis

/**
* Bundles all dependencies from the given [configuration] into a single, dedicated jar and returns a file collection
* containing that jar.
* Primarily for use in dependency declarations, so fat jars of certain dependencies (with potentially relocated
* transitive dependencies) can be created and then depended upon as usual. Compared to simply relocating in a later
* shadow task, this has the advantage that IDEA will see the relocated dependency rather than the original, which e.g.
* allows one to use two different versions of the same dependency at dev time.
*
* If [jijName] is provided, the fat jar will additionally be wrapped in an outer jar, such that the classes are not
* actually visible if the file collection is put onto the classpath. This may be useful when the jar is never meant to
* directly be on the classpath but rather only in a dedicated class loader or JVM.
* The given [jijName] determines the path+name of the inner jar within the outer jar.
*/
fun Project.prebundleNow(configuration: Configuration, jijName: String? = null, configure: PatternFilterable.() -> Unit = {}): FileCollection {
val output = projectDir
.resolve(".gradle")
.resolve("prebundled-jars")
.resolve("${configuration.name}.jar")

val filter = PatternSet().apply(configure)

bundle(configuration, filter, jijName, output, logger)

return files(output)
}

private fun Project.bundle(configuration: Configuration, filter: PatternSet, jijName: String?, output: File, logger: Logger) {
output.parentFile.mkdirs()

val hash = configuration.computeHash().apply {
update(filter.hashCode().toBigInteger().toByteArray())
update(jijName?.toByteArray() ?: byteArrayOf())
update(byteArrayOf(0, 0, 0, 2)) // code version, incremented with each semantic change
}.digest()
val hashFile = output.resolveSibling(output.name + ".md5")
if (hashFile.exists() && hashFile.readBytes().contentEquals(hash) && output.exists()) {
return
}
hashFile.delete()
output.delete()

val stopwatch = Stopwatch.createStarted()
logger.lifecycle(":preparing ${configuration.name} jar")

val spec = filter.asSpec
val visitedEntries = mutableSetOf<String>()
output.outputStream().use { fileOut_ ->
var fileOut: OutputStream = fileOut_
if (jijName != null) {
fileOut = JarOutputStream(fileOut).apply {
putNextEntry(ZipEntry(jijName))
}
}
JarOutputStream(fileOut).use { jarOut ->
for (sourceFile in configuration.files) {
project.zipTree(sourceFile).visit {
if (!visitedEntries.add(path)) return@visit
if (!spec.isSatisfiedBy(this)) return@visit

jarOut.putNextEntry(ZipEntry(if (isDirectory) "$path/" else path).apply { time = CONSTANT_TIME_FOR_ZIP_ENTRIES })
open().use { copyTo(jarOut) }
jarOut.closeEntry()
}
}
}
}
hashFile.writeBytes(hash)

logger.lifecycle(":prepared ${configuration.name} jar in $stopwatch")
}

private fun Configuration.computeHash(): MessageDigest = files
.sortedBy { it.name }
.fold(MessageDigest.getInstance("MD5")) { digest, file ->
// if the file path already contains a hash, that's good enough, otherwise we need to read its contents
digest.update(file.findHashInPath()?.toByteArray() ?: file.readBytes())
digest
}

private fun File.findHashInPath(): String? {
val path = absolutePath.replace('\\', '/')
if ("/caches/modules-2/files-2.1/" in path && parentFile.name.length == 40) {
return parentFile.name
}
if ("/caches/transforms-3/" in path && parentFile.parentFile.name.length == 32) {
return parentFile.parentFile.name
}
return null
}
Empty file added client/1.20-fabric/.gitkeep
Empty file.
43 changes: 25 additions & 18 deletions client/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import gg.essential.gradle.multiversion.excludeKotlinDefaultImpls
import gg.essential.gradle.multiversion.mergePlatformSpecifics
import gg.essential.gradle.util.RelocationTransform.Companion.registerRelocationAttribute
import gg.essential.gradle.util.noServerRunConfigs
import gg.essential.util.prebundleNow

val mavenGroup: String by rootProject
val isMainProject = project.name == file("../mainProject").readText().trim()
Expand All @@ -10,6 +12,7 @@ plugins {
id("gg.essential.multi-version")
id("gg.essential.defaults")
id("su.plo.crowdin.plugin")
id("su.plo.voice.relocate")
}

group = "$mavenGroup.client"
Expand Down Expand Up @@ -42,6 +45,13 @@ plasmoCrowdin {

val shadowCommon by configurations.creating

val relocatedUC = registerRelocationAttribute("relocate-uc") {
relocate("gg.essential.universal", "su.plo.voice.universal")
}
val universalCraft by configurations.creating {
attributes { attribute(relocatedUC, true) }
}

repositories {
maven("https://repo.essential.gg/repository/maven-public")
maven("https://repo.spongepowered.org/repository/maven-public/")
Expand All @@ -58,32 +68,22 @@ dependencies {
11902 -> "0.73.2+1.19.2"
11903 -> "0.73.2+1.19.3"
11904 -> "0.76.0+1.19.4"
12000 -> "0.83.0+1.20"
else -> throw GradleException("Unsupported platform $platform")
}

modImplementation("net.fabricmc.fabric-api:fabric-api:${fabricApiVersion}")
"include"(modImplementation("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")!!)
"include"("net.fabricmc:fabric-language-kotlin:1.9.1+kotlin.1.8.10")
// "include"("net.fabricmc:fabric-language-kotlin:1.9.1+kotlin.1.8.10")
}

modApi(rootProject.libs.versions.universalcraft.map {
universalCraft(rootProject.libs.versions.universalcraft.map {
"gg.essential:universalcraft-$platform:$it"
}) {
exclude(group = "org.jetbrains.kotlin")
}
if (platform.isForge) {
shadowCommon(rootProject.libs.versions.universalcraft.map {
"gg.essential:universalcraft-$platform:$it"
}) {
isTransitive = false
}
} else {
"include"(rootProject.libs.versions.universalcraft.map {
"gg.essential:universalcraft-$platform:$it"
}) {
isTransitive = false
}
isTransitive = false
}
modApi(prebundleNow(universalCraft))
shadowCommon(prebundleNow(universalCraft))

rootProject.libs.versions.ustats.map { "su.plo.ustats:$platform:$it" }.also {
modApi(it)
Expand Down Expand Up @@ -112,6 +112,12 @@ dependencies {
}
}

// kotlin
shadowCommon(kotlin("stdlib-jdk8"))
shadowCommon(rootProject.libs.kotlinx.coroutines)
shadowCommon(rootProject.libs.kotlinx.coroutines.jdk8)
shadowCommon(rootProject.libs.kotlinx.json)

shadowCommon(rootProject.libs.opus)
shadowCommon(rootProject.libs.config)
shadowCommon(rootProject.libs.rnnoise)
Expand Down Expand Up @@ -147,9 +153,9 @@ tasks {
shadowJar {
configurations = listOf(shadowCommon)

relocate("su.plo.crowdin", "su.plo.voice.crowdin")
relocate("su.plo.crowdin", "su.plo.voice.libs.crowdin")

if (platform.isForge) {
relocate("gg.essential.universal", "su.plo.voice.universal")
relocate("su.plo.ustats", "su.plo.voice.ustats")
}

Expand All @@ -167,6 +173,7 @@ tasks {
exclude("plasmovoice-forge.mixins.json")
exclude("pack.mcmeta")
exclude("META-INF/mods.toml")
exclude("DebugProbesKt.bin")
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion client/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
essential.defaults.loom=1
essential.defaults.loom.mappings=official
essential.defaults.loom.fabric-loader=net.fabricmc:fabric-loader:0.14.9
essential.defaults.loom.fabric-loader=net.fabricmc:fabric-loader:0.14.21

org.gradle.daemon=false
org.gradle.parallel=true
Expand Down
3 changes: 3 additions & 0 deletions client/root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ group = "$mavenGroup.client-root"

preprocess {

val fabric12000 = createNode("1.20-fabric", 12000, "official")
val forge11904 = createNode("1.19.4-forge", 11904, "official")
val fabric11904 = createNode("1.19.4-fabric", 11904, "official")
val forge11903 = createNode("1.19.3-forge", 11903, "official")
val fabric11903 = createNode("1.19.3-fabric", 11903, "official")
val forge11902 = createNode("1.19.2-forge", 11902, "official")
val fabric11902 = createNode("1.19.2-fabric", 11902, "official")

fabric12000.link(fabric11904)

forge11903.link(fabric11903)

fabric11904.link(fabric11903)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package su.plo.lib.mod.client.chat;

import gg.essential.universal.UMinecraft;
import su.plo.voice.universal.UMinecraft;
import lombok.NonNull;
import lombok.experimental.UtilityClass;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package su.plo.lib.mod.client.chat;

import gg.essential.universal.wrappers.message.UTextComponent;
import su.plo.voice.universal.wrappers.message.UTextComponent;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.minecraft.network.chat.Component;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package su.plo.lib.mod.client.gui.components;

import gg.essential.universal.UKeyboard;
import su.plo.voice.universal.UKeyboard;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.plo.lib.api.chat.MinecraftTextComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package su.plo.lib.mod.client.gui.components;

import com.google.common.collect.Lists;
import gg.essential.universal.UGraphics;
import gg.essential.universal.UMatrixStack;
import su.plo.voice.universal.UGraphics;
import su.plo.voice.universal.UMatrixStack;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package su.plo.lib.mod.client.gui.components;

import gg.essential.universal.UGraphics;
import gg.essential.universal.UKeyboard;
import gg.essential.universal.UMatrixStack;
import su.plo.voice.universal.UGraphics;
import su.plo.voice.universal.UKeyboard;
import su.plo.voice.universal.UMatrixStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import su.plo.lib.api.MathLib;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package su.plo.lib.mod.client.gui.components;

import gg.essential.universal.UMatrixStack;
import su.plo.voice.universal.UMatrixStack;
import org.jetbrains.annotations.NotNull;
import su.plo.lib.api.chat.MinecraftTextComponent;
import su.plo.lib.mod.client.gui.narration.NarrationOutput;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package su.plo.lib.mod.client.gui.components;

import gg.essential.universal.UGraphics;
import gg.essential.universal.UMatrixStack;
import su.plo.voice.universal.UGraphics;
import su.plo.voice.universal.UMatrixStack;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.resources.ResourceLocation;
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 92d53e4

Please sign in to comment.