diff options
20 files changed, 397 insertions, 247 deletions
@@ -1,7 +1,16 @@ -# Chatting +<div align="center"> -<a href="https://github.com/W-OVERFLOW/Chatting/releases" target="_blank"></a> -<img alt="downloads" src="https://img.shields.io/github/downloads/W-OVERFLOW/Chatting/total?color=F5C400&style=for-the-badge" /> <img alt="downloads latest" src="https://img.shields.io/github/downloads-pre/W-OVERFLOW/Chatting/latest/total?color=F5C400&style=for-the-badge" /> +# `Chatting` +A chat mod adding utilities such as extremely customizable chat tabs, chat shortcuts, chat screenshots, and message copying.\ +<img alt="downloads" src="https://img.shields.io/github/downloads/W-OVERFLOW/Chatting/total?color=F5C400&style=for-the-badge" /> <img alt="downloads latest" src="https://img.shields.io/github/downloads-pre/W-OVERFLOW/Chatting/latest/total?color=F5C400&style=for-the-badge" />\ +[Report a Bug][bugreps] +· +[Request a Feature][featreqs] +· +[Documentation][docs] -Chatting is a chat mod adding utilities such as extremely customizable chat tabs, chat shortcuts, chat screenshots, and message copying. +</div> +[bugreps]: https://github.com/W-OVERFLOW/Chatting/issues +[featreqs]: https://woverflow.cc/discord +[docs]: docs/docs.md diff --git a/build.gradle b/build.gradle index e9af2ed..17cd5f6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,16 @@ -//file:noinspection GradlePackageUpdate +//file:noinspection UnnecessaryQualifiedReference +//file:noinspection GroovyAssignabilityCheck + plugins { - id "net.minecraftforge.gradle.forge" version "6f53277" - id "com.github.johnrengelman.shadow" version "6.1.0" - id 'org.spongepowered.mixin' version "d5f9873" - id 'org.jetbrains.kotlin.jvm' version "1.6.10" + id "dev.architectury.architectury-pack200" version "0.1.3" + id 'org.jetbrains.kotlin.jvm' version '1.6.10' + id "cc.woverflow.loom" version "0.10.1" id "net.kyori.blossom" version "1.3.0" id "java" } version = mod_version -group = "cc.woverflow" +group = "com.example" archivesBaseName = mod_name blossom { @@ -18,23 +19,31 @@ blossom { replaceToken("@NAME@", mod_name, className) replaceToken("@ID@", mod_id, className) } - -sourceCompatibility = targetCompatibility = 1.8 +kotlin.jvmToolchain { + languageVersion = JavaLanguageVersion.of(8) +} compileJava.options.encoding = 'UTF-8' -minecraft { - version = "1.8.9-11.15.1.2318-1.8.9" - runDir = "run" - mappings = "stable_22" - makeObfSourceJar = false - - clientRunArgs += "--mixin mixins.${mod_id}.json" - clientRunArgs += '--tweakClass gg.essential.loader.stage0.EssentialSetupTweaker' - clientJvmArgs += '-Dfml.coreMods.load=cc.woverflow.wcore.tweaker.WCoreTweaker' +loom { + launchConfigs { + client { + arg("--tweakClass", "cc.woverflow.onecore.tweaker.OneCoreTweaker") + property("onecore.mixin", "mixins.${mod_id}.json") + } + } + runConfigs { + client { + ideConfigGenerated = true + } + } + forge { + pack200Provider = new dev.architectury.pack200.java.Pack200Adapter() + mixinConfig("mixins.${mod_id}.json") + mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json") + } } configurations { - // Creates an extra configuration that implements `implementation` to be used later as the configuration that shades libraries include implementation.extendsFrom(include) } @@ -44,27 +53,20 @@ repositories { } dependencies { - include ('gg.essential:loader-launchwrapper:1.1.3') { - transitive = false - } - compileOnly 'gg.essential:essential-1.8.9-forge:1788' - compileOnly annotationProcessor ('org.spongepowered:mixin:0.8.5-SNAPSHOT') - annotationProcessor("com.google.code.gson:gson:2.2.4") - annotationProcessor("com.google.guava:guava:21.0") - annotationProcessor("org.ow2.asm:asm-tree:6.2") - compileOnly 'cc.woverflow:w-core:1.1.3' - include ('cc.woverflow:w-core-tweaker:1.0.2') { + minecraft("com.mojang:minecraft:1.8.9") + mappings("de.oceanlabs.mcp:mcp_stable:22-1.8.9") + forge("net.minecraftforge:forge:1.8.9-11.15.1.2318-1.8.9") + compileOnly 'gg.essential:essential-1.8.9-forge:1933' + compileOnly 'cc.woverflow:onecore:1.3.3' + include ('cc.woverflow:onecore-tweaker:1.3.0') { transitive = false } + compileOnly ('org.spongepowered:mixin:0.8.5-SNAPSHOT') } -/** - * This task simply replaces the `${version}` and `${mcversion}` properties in the mcmod.info with the data from Gradle - */ processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", version - inputs.property "mcversion", minecraft.version inputs.property "name", mod_name inputs.property "id", mod_id @@ -72,10 +74,10 @@ processResources { expand( "id": mod_id, "name": mod_name, - "version": version, - "mcversion": minecraft.version + "version": version ) } + filesMatching("mixins.${mod_id}.json") { expand("id": mod_id) } @@ -83,57 +85,29 @@ processResources { rename '(.+_at.cfg)', 'META-INF/$1' } -jar { - manifest.attributes( - "ModSide": "CLIENT", - "TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker", - "TweakOrder": "0", - "MixinConfigs": "mixins.chatting.json", - 'ForceLoadAsMod': true, - "FMLCorePlugin": "cc.woverflow.wcore.tweaker.WCoreTweaker", - "FMLCorePluginContainsFMLMod": true - ) - - enabled = false -} - -/** - * This task simply moves resources so they can be accessed at runtime, Forge is quite weird isn't it - */ -task moveResources { - doLast { - ant.move file: "${buildDir}/resources/main", - todir: "${buildDir}/classes/kotlin" - } -} - -moveResources.dependsOn processResources -classes.dependsOn moveResources - -mixin { - disableRefMapWarning = true - defaultObfuscationEnv searge - add sourceSets.main, "mixins.${mod_id}.refmap.json" -} - -// This adds support to ("include") libraries into our JAR -shadowJar { - archiveClassifier.set('') - configurations = [project.configurations.include] - duplicatesStrategy DuplicatesStrategy.EXCLUDE -} - -reobf { - shadowJar { - classpath = sourceSets.main.compileClasspath - } -} - -tasks.reobfJar.dependsOn tasks.shadowJar sourceSets { dummy main { compileClasspath += dummy.output - ext.refMap = "mixins.${mod_id}.refmap.json" + output.resourcesDir = java.classesDirectory + } +} + +jar { + dependsOn configurations.include + from(configurations.include.collect { it.isDirectory() ? it : zipTree(it) }) { + def i = 0 + filesMatching("META-INF/NOTICE*") { name = "$name.${i++}" } + filesMatching("META-INF/LICENSE*") { name = "$name.${i++}" } + filesMatching("META-INF/mods.toml") { name = "$name.${i++}" } + filesMatching("LICENSE*") { name = "$name.${i++}" } } + + manifest.attributes( + 'ModSide': 'CLIENT', + 'ForceLoadAsMod': true, + 'TweakClass': 'cc.woverflow.onecore.tweaker.OneCoreTweaker', + 'MixinConfigs': "mixins.${mod_id}.json", + "TweakOrder": "0" + ) }
\ No newline at end of file diff --git a/docs/chattabs.md b/docs/chattabs.md new file mode 100644 index 0000000..6caeaaf --- /dev/null +++ b/docs/chattabs.md @@ -0,0 +1,201 @@ +# Chatting Chat Tabs + +## Syntax + +The file for Chat Tabs is in `{MINECRAFT DIRECTORY}/W-OVERFLOW/Chatting/chattabs.json`. The default file will look +something like this: + +```json +{ + "tabs": [ + { + "enabled": true, + "name": "ALL", + "unformatted": false, + "prefix": "" + }, + { + "enabled": true, + "name": "PARTY", + "unformatted": false, + "starts": [ + "§r§9Party §8> ", + "§r§9P §8> ", + "§eThe party was transferred to §r", + "§eKicked §r" + ], + "ends": [ + "§r§ehas invited you to join their party!", + "§r§eto the party! They have §r§c60 §r§eseconds to accept.§r", + "§r§ehas disbanded the party!§r", + "§r§ehas disconnected, they have §r§c5 §r§eminutes to rejoin before they are removed from the party.§r", + " §r§ejoined the party.§r", + " §r§ehas left the party.§r", + " §r§ehas been removed from the party.§r", + "§r§e because they were offline.§r" + ], + "equals": [ + "§cThe party was disbanded because all invites expired and the party was empty§r" + ], + "regex": [ + "(§r)*(§9Party §8>)+(.*)", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§einvited §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto the party! They have §r§c60 §r§eseconds to accept\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas left the party\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ejoined the party\\.§r", + "§eYou left the party\\.§r", + "§eYou have joined §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)'s §r§eparty!§r", + "§cThe party was disbanded because all invites expired and the party was empty§r", + "§cYou cannot invite that player since they're not online\\.§r", + "§eThe party leader, §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e, warped you to §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e's house\\.§r", + "§eSkyBlock Party Warp §r§7\\([0-9]+ players?\\)§r", + "§a. §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§f §r§awarped to your server§r", + "§eYou summoned §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§f §r§eto your server\\.§r", + "§eThe party leader, §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e, warped you to their house\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§aenabled Private Game§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§cdisabled Private Game§r", + "§cThe party is now muted\\. §r", + "§aThe party is no longer muted\\.§r", + "§cThere are no offline players to remove\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas been removed from the party\\.§r", + "§eThe party was transferred to §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eby §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e has promoted §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto Party Leader§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e has promoted §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto Party Moderator§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eis now a Party Moderator§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r§e has demoted §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§eto Party Member§r", + "§cYou can't demote yourself!§r", + "§6Party Members \\([0-9]+\\)§r", + "§eParty Leader: §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) ?§r(?:§[a-zA-Z0-9]).§r", + "§eParty Members: §r(?:(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r(?:§[a-zA-Z0-9]) . §r)+", + "§eParty Moderators: §r(?:(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+)§r(?:§[a-zA-Z0-9]) . §r)+", + "§eThe party invite to §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas expired§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§cdisabled All Invite§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§aenabled All Invite§r", + "§cYou cannot invite that player\\.§r", + "§cYou are not allowed to invite players\\.§r", + "§eThe party leader, §r(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas disconnected, they have §r§c5 §r§eminutes to rejoin before the party is disbanded\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)|(?:VIP§r§6\\+)|(?:MVP)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+)|(?:MVP(?:§r)?(?:§[a-zA-Z0-9])\\+\\+)|(?:(?:§r)?§fYOUTUBE))(?:§r)?(?:(?:§[a-zA-Z0-9]))?\\] [a-zA-Z0-9_]+|§7[a-zA-Z0-9_]+) §r§ehas disconnected, they have §r§c5 §r§eminutes to rejoin before they are removed from the party.§r", + "§cYou are not in a party right now\\.§r", + "§cThis party is currently muted\\.§r", + "(§r)*(§9P §8>)+(.*)" + ], + "prefix": "/pc " + }, + { + "enabled": true, + "name": "GUILD", + "unformatted": true, + "starts": [ + "Guild >", + "G >" + ], + "prefix": "/gc " + }, + { + "enabled": true, + "name": "PM", + "unformatted": true, + "starts": [ + "To ", + "From " + ], + "prefix": "/r " + } + ], + "version": 3 +} +``` + +The `version` property stores the version number of the Chat Tabs JSON file. This should not be touched unless you have +an older Chat Tab JSON and would like Chatting to automatically migrate to the newer version. + +The `tabs` property stores all the chat tabs, in the order they should be displayed in. By default, there are 4 chat +tabs - ALL, PARTY, GUILD, and PM. ALL simply shows all messages; nothing is filtered. PARTY shows only party messages, +GUILD shows only guild messages, and PM only shows private messages. These can be modified to the user's free will. + +### Tab Syntax + +This is the default PARTY chat tab. We will be using this as an example, as it utilizes most of the chat tab features +that you may want to use. + +```json +{ + "enabled": true, + "name": "PARTY", + "unformatted": false, + "starts": [ + "§r§9Party §8> ", + "§r§9P §8> ", + "§eThe party was transferred to §r", + "§eKicked §r" + ], + "ends": [ + "§r§ehas invited you to join their party!", + ... + "§r§e because they were offline.§r" + ], + "equals": [ + "§cThe party was disbanded because all invites expired and the party was empty§r" + ], + "regex": [ + "(§r)*(§9Party §8>)+(.*)", + "(?:(?:§[a-zA-Z0-9])*\\[(...seconds to accept\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP)... §r§ehas left the party\\.§r", + "(?:(?:§[a-zA-Z0-9])*\\[(?:(?:VIP...joined the party\\.§r", + ... + "(§r)*(§9P §8>)+(.*)" + ], + "prefix": "/pc " +} +``` + +The `enabled` property allows you to disable a chat tab without removing the tab from the JSON file. Users will be able +to directly manage this property via a GUI in the future. + +The `name` property allows you to customize the display name of the tab. + +The `unformatted` property allows you to toggle whether the filters go through the raw message sent or the message +without color / formatting codes. For example... + +BEFORE + +```json +{ + "enabled": true, + "name": "EXAMPLE", + "unformatted": false, + "starts": [ + "§r§9Message §8> " + ] +} +``` + +AFTER + +```json +{ + "enabled": true, + "name": "EXAMPLE", + "unformatted": true, + "starts": [ + "Message > " + ] +} +``` + +The `starts` property allows you to only allow a message if it starts with a string in the `starts` property. For +example, if a message which contents were "Hello!", it would not be allowed, as it does not start anything in +the `starts` property. + +The `ends` property does a similar function, except only allowing a message if it **ends** with anything in the `ends` +property rather than if it starts with anything. + +The `equals` property allows you to only allow a message if it equals with a string in the `equals` property. **_THIS IS +CASE SENSITIVE._** + +The `regex` property allows you to only allow a message if it matches a regex in the `regex` property. + +You can append `ignore_` to `starts`, `ends`, `equals`, or `regex` to ignore messages that match rather than allow, and +of course use both at the same time. + +The `prefix` property appends the prefix to any message sent while in the specific chat tab **if it is not a command**. +This can be used to automatically send messages in a specific channel in servers, like in Hypixel.
\ No newline at end of file diff --git a/docs/docs.md b/docs/docs.md new file mode 100644 index 0000000..b7ff82a --- /dev/null +++ b/docs/docs.md @@ -0,0 +1,3 @@ +# Chatting Docs + +## - [Chat Tabs](chattabs.md)
\ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a5b4f2d..b79423e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,6 @@ org.gradle.jvmargs=-Xmx2G mod_name = Chatting mod_id = chatting -mod_version = 1.3.0
\ No newline at end of file +mod_version = 1.4.0-alpha1 + +loom.platform = forge
\ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c19e35b..b1159fc 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index ff1e01b..6b018a3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,29 +1,12 @@ pluginManagement { repositories { - mavenCentral() gradlePluginPortal() - - // Add the Forge Repository (ForgeGradle fetches most of its stuff from here) - maven { - name = "Forge" - url = "https://maven.minecraftforge.net" - } - - // Add the Jitpack Repository (We fetch ForgeGradle from this) - maven { - name = "Jitpack" - url = "https://jitpack.io/" - } + maven { url = "https://repo.woverflow.cc" } } resolutionStrategy { eachPlugin { - switch (requested.id.id) { - case 'net.minecraftforge.gradle.forge': - useModule "com.github.asbyth:ForgeGradle:${requested.version}" - break - case 'org.spongepowered.mixin': - useModule "com.github.Skytils:MixinGradle:${requested.version}" - break + if (requested.id.id == "cc.woverflow.loom") { + useModule("cc.woverflow:architectury-loom:${requested.version}") } } } diff --git a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java index 9c292c6..d6a0b15 100644 --- a/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java +++ b/src/main/java/cc/woverflow/chatting/mixin/GuiNewChatMixin.java @@ -106,8 +106,11 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { if (mouseX >= (left + ModCompatHooks.getXOffset()) && mouseY < bottom && mouseX < (right + 11 + ModCompatHooks.getXOffset()) && mouseY >= top) { chatting$shouldCopy = true; drawCopyChatBox(right, top); + args.set(4, ChattingConfig.INSTANCE.getHoveredChatBackgroundColor().getRGB()); + return; } } + args.set(4, ChattingConfig.INSTANCE.getChatBackgroundColor().getRGB()); } @Redirect(method = "drawChat", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiNewChat;drawnChatLines:Ljava/util/List;", opcode = Opcodes.GETFIELD)) @@ -125,14 +128,6 @@ public abstract class GuiNewChatMixin extends Gui implements GuiNewChatHook { return ModCompatHooks.redirectDrawString(text, x, y, color); } - @ModifyArg(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 0), index = 4) - private int changeChatBackgroundColor(int color) { - return (((color >> 24) & 0xFF) << 24) | - ((ChattingConfig.INSTANCE.getChatBackgroundColor().getRed() & 0xFF) << 16) | - ((ChattingConfig.INSTANCE.getChatBackgroundColor().getGreen() & 0xFF) << 8) | - ((ChattingConfig.INSTANCE.getChatBackgroundColor().getBlue() & 0xFF)); - } - @Redirect(method = "drawChat", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiNewChat;drawRect(IIIII)V", ordinal = 1)) private void redirectScrollBar(int left, int top, int right, int bottom, int color) { if (!ChattingConfig.INSTANCE.getRemoveScrollBar()) { diff --git a/src/main/java/cc/woverflow/chatting/mixin/RedactionNameHighlightMixin.java b/src/main/java/cc/woverflow/chatting/mixin/RedactionNameHighlightMixin.java deleted file mode 100644 index eab1bfe..0000000 --- a/src/main/java/cc/woverflow/chatting/mixin/RedactionNameHighlightMixin.java +++ /dev/null @@ -1,22 +0,0 @@ -package cc.woverflow.chatting.mixin; - -import cc.woverflow.chatting.utils.RenderUtils; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Pseudo; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -@Pseudo -@Mixin(targets = "net.wyvest.redaction.features.NameHighlight") -public class RedactionNameHighlightMixin { - - @Dynamic("REDACTION") - @Inject(method = "highlightName", at = @At("HEAD"), cancellable = true) - private static void onNameHighlight(String text, CallbackInfoReturnable<String> cir) { - if (RenderUtils.getBypassNameHighlight()) { - cir.setReturnValue(text); - } - } -} diff --git a/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java b/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java deleted file mode 100644 index 4c7448e..0000000 --- a/src/main/java/cc/woverflow/chatting/mixin/WyvtilsListenerMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package cc.woverflow.chatting.mixin; - -import cc.woverflow.chatting.utils.RenderUtils; -import org.spongepowered.asm.mixin.Dynamic; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Pseudo; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Coerce; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Pseudo -@Mixin(targets = "net.wyvest.wyvtils.core.listener.Listener") -public class WyvtilsListenerMixin { - - @Dynamic("Wyvtils") - @Inject(method = "onStringRendered", at = @At("HEAD"), cancellable = true, remap = false) - private void cancelStringRender(@Coerce Object a, CallbackInfo ci) { - if (RenderUtils.getBypassNameHighlight()) ci.cancel(); - } -} diff --git a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt index 1f7c47d..fa24065 100644 --- a/src/main/kotlin/cc/woverflow/chatting/Chatting.kt +++ b/src/main/kotlin/cc/woverflow/chatting/Chatting.kt @@ -10,10 +10,7 @@ import cc.woverflow.chatting.utils.ModCompatHooks import cc.woverflow.chatting.utils.copyToClipboard import cc.woverflow.chatting.utils.createBindFramebuffer import cc.woverflow.chatting.utils.screenshot -import cc.woverflow.wcore.utils.Updater -import cc.woverflow.wcore.utils.command -import cc.woverflow.wcore.utils.openGUI -import gg.essential.api.EssentialAPI +import cc.woverflow.onecore.utils.* import gg.essential.universal.UDesktop import gg.essential.universal.UResolution import net.minecraft.client.Minecraft @@ -78,7 +75,7 @@ object Chatting { ChattingConfig.preload() command("chatting", aliases = arrayListOf("stratus")) { main { - ChattingConfig.openGUI() + ChattingConfig.openScreen() } } ClientRegistry.registerKeyBinding(keybind) @@ -99,11 +96,13 @@ object Chatting { fun onForgeLoad(event: FMLLoadCompleteEvent) { if (ChattingConfig.informForAlternatives) { if (isHychat) { - EssentialAPI.getNotifications().push(NAME, "Hychat can be removed at it is replaced by Chatting.") + sendBrandedNotification(NAME, "Hychat can be removed at it is replaced by Chatting. Click here for more information.", action = { + UDesktop.browseURL("https://github.com/MicrocontrollersDev/Alternatives/blob/main/Hychat.md") + }) } if (isSkytils) { if (Config.chatTabs) { - EssentialAPI.getNotifications().push(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = { + sendBrandedNotification(NAME, "Skytils' chat tabs can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = { Config.chatTabs = false ChattingConfig.chatTabs = true ChattingConfig.hypixelOnlyChatTabs = true @@ -112,7 +111,7 @@ object Chatting { }) } if (Config.copyChat) { - EssentialAPI.getNotifications().push(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = { + sendBrandedNotification(NAME, "Skytils' copy chat messages can be disabled as it is replace by Chatting.\nClick here to automatically do this.", 6F, action = { Config.copyChat = false Config.markDirty() Config.writeData() @@ -169,11 +168,11 @@ object Chatting { private fun screenshot(messages: List<String>): BufferedImage? { if (messages.isEmpty()) { - EssentialAPI.getNotifications().push("Chatting", "Chat window is empty.") + sendBrandedNotification("Chatting", "Chat window is empty.") return null } if (!OpenGlHelper.isFramebufferEnabled()) { - EssentialAPI.getNotifications().push("Chatting", "Screenshot failed, please disable “Fast Render” in OptiFine’s “Performance” tab.") + sendBrandedNotification("Chatting", "Screenshot failed, please disable “Fast Render” in OptiFine’s “Performance” tab.") return null } @@ -192,10 +191,9 @@ object Chatting { val image = fb.screenshot(file) Minecraft.getMinecraft().entityRenderer.setupOverlayRendering() Minecraft.getMinecraft().framebuffer.bindFramebuffer(true) - EssentialAPI.getNotifications() - .push("Chatting", "Chat screenshotted successfully." + (if (ChattingConfig.copyMode != 1) "\nClick to open." else ""), action = { + sendBrandedNotification("Chatting", "Chat screenshotted successfully." + (if (ChattingConfig.copyMode != 1) "\nClick to open." else ""), action = { if (!UDesktop.open(file)) { - EssentialAPI.getNotifications().push("Chatting", "Could not browse!") + sendBrandedNotification("Chatting", "Could not browse!") } }) return image diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt index 236ccf6..1e20b01 100644 --- a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt +++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTab.kt @@ -2,7 +2,6 @@ package cc.woverflow.chatting.chat import cc.woverflow.chatting.gui.components.TabButton import com.google.gson.annotations.SerializedName -import kotlinx.coroutines.runBlocking import net.minecraft.client.Minecraft import net.minecraft.util.EnumChatFormatting import net.minecraft.util.IChatComponent @@ -16,28 +15,60 @@ data class ChatTab( @SerializedName("ends") val endsWith: List<String>?, val equals: List<String>?, @SerializedName("regex") val uncompiledRegex: List<String>?, - val prefix: String + @SerializedName("ignore_starts") val ignoreStartsWith: List<String>?, + @SerializedName("ignore_contains") val ignoreContains: List<String>?, + @SerializedName("ignore_ends") val ignoreEndsWith: List<String>?, + @SerializedName("ignore_equals") val ignoreEquals: List<String>?, + @SerializedName("ignore_regex") val uncompiledIgnoreRegex: List<String>?, + val prefix: String, ) { lateinit var button: TabButton lateinit var compiledRegex: ChatRegexes + lateinit var compiledIgnoreRegex: ChatRegexes //Ugly hack to make GSON not make button / regex null fun initialize() { compiledRegex = ChatRegexes(uncompiledRegex) + compiledIgnoreRegex = ChatRegexes(uncompiledIgnoreRegex) val width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(name) - button = TabButton(653452, runBlocking { + button = TabButton(653452, run { val returnValue = x - 2 x += 6 + width - return@runBlocking returnValue + return@run returnValue }, width + 4, 12, this) } fun shouldRender(chatComponent: IChatComponent): Boolean { - if (startsWith == null && equals == null && endsWith == null && contains == null && uncompiledRegex == null) { - return true - } val message = if (unformatted) EnumChatFormatting.getTextWithoutFormattingCodes(chatComponent.unformattedText) else chatComponent.formattedText + ignoreStartsWith?.forEach { + if (message.startsWith(it)) { + return false + } + } + ignoreEquals?.forEach { + if (message == it) { + return false + } + } + ignoreEndsWith?.forEach { + if (message.endsWith(it)) { + return false + } + } + ignoreContains?.forEach { + if (message.contains(it)) { + return false + } + } + compiledIgnoreRegex.compiledRegexList.forEach { + if (it.matches(message)) { + return false + } + } + if (startsWith.isNullOrEmpty() && equals.isNullOrEmpty() && endsWith.isNullOrEmpty() && contains.isNullOrEmpty() && uncompiledRegex.isNullOrEmpty()) { + return true + } equals?.forEach { if (message == it) { return true @@ -66,22 +97,6 @@ data class ChatTab( return false } - override fun equals(other: Any?): Boolean { - return other is ChatTab && name == other.name && startsWith == other.startsWith && contains == other.contains && endsWith == other.endsWith && equals == other.equals && compiledRegex == other.compiledRegex - } - - override fun hashCode(): Int { - var result = name.hashCode() - result = 31 * result + (startsWith?.hashCode() ?: 0) - result = 31 * result + (contains?.hashCode() ?: 0) - result = 31 * result + (endsWith?.hashCode() ?: 0) - result = 31 * result + (equals?.hashCode() ?: 0) - result = 31 * result + (uncompiledRegex?.hashCode() ?: 0) - result = 31 * result + prefix.hashCode() - result = 31 * result + button.hashCode() - return result - } - companion object { private var x = 4 } diff --git a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt index 5525a51..ec9dfc8 100644 --- a/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt +++ b/src/main/kotlin/cc/woverflow/chatting/chat/ChatTabs.kt @@ -37,13 +37,24 @@ object ChatTabs { } else { try { val chatTabJson = GSON.fromJson(tabFile.readText(), ChatTabsJson::class.java) - if (chatTabJson.version == 1) { - // ver 2 adds `enabled` - chatTabJson.tabs.forEach { - it.asJsonObject.addProperty("enabled", true) + when (chatTabJson.version) { + 1 -> { + // ver 2 adds `enabled` + chatTabJson.tabs.forEach { + applyVersion2Changes(it.asJsonObject) + applyVersion3Changes(it.asJsonObject) + } + chatTabJson.version = 3 + tabFile.writeText(chatTabJson.toString()) + } + 2 -> { + // ver 2 adds `enabled` + chatTabJson.tabs.forEach { + applyVersion3Changes(it.asJsonObject) + } + chatTabJson.version = 3 + tabFile.writeText(chatTabJson.toString()) } - chatTabJson.version = 2 - tabFile.writeText(chatTabJson.toString()) } chatTabJson.tabs.forEach { val chatTab = GSON.fromJson(it.toString(), ChatTab::class.java) @@ -63,6 +74,18 @@ object ChatTabs { currentTab = tabs[0] } + private fun applyVersion2Changes(json: JsonObject) { + json.addProperty("enabled", true) + } + + private fun applyVersion3Changes(json: JsonObject) { + json.add("ignore_starts", JsonArray()) + json.add("ignore_contains", JsonArray()) + json.add("ignore_ends", JsonArray()) + json.add("ignore_equals", JsonArray()) + json.add("ignore_regex", JsonArray()) + } + fun shouldRender(message: IChatComponent): Boolean { return currentTab?.shouldRender(message) ?: true } @@ -72,12 +95,12 @@ object ChatTabs { val jsonObject = JsonObject() val defaultTabs = generateDefaultTabs() jsonObject.add("tabs", defaultTabs) - jsonObject.addProperty("version", 1) + jsonObject.addProperty("version", 3) tabFile.writeText(jsonObject.toString()) } private fun generateDefaultTabs(): JsonArray { - val all = ChatTab(true, "ALL", false, null, null, null, null, null, "") + val all = ChatTab(true, "ALL", false, null, null, null, null, null, null, null, null, null, null, "") val party = ChatTab( true, "PARTY", @@ -136,6 +159,11 @@ object ChatTabs { "§cThis party is currently muted\\.§r", "(§r)*(§9P §8\u003e)+(.*)" ), + null, + null, + null, + null, + null, "/pc " ) val guild = ChatTab( @@ -147,6 +175,11 @@ object ChatTabs { null, null, null, + null, + null, + null, + null, + null, "/gc " ) val pm = ChatTab( @@ -158,6 +191,11 @@ object ChatTabs { null, null, null, + null, + null, + null, + null, + null, "/r " ) tabs.add(all) diff --git a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt index 67db660..6c09731 100644 --- a/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt +++ b/src/main/kotlin/cc/woverflow/chatting/config/ChattingConfig.kt @@ -45,10 +45,17 @@ object ChattingConfig : Vigilant(File(Chatting.modDir, "${Chatting.ID}.toml"), C type = PropertyType.COLOR, name = "Chat Background Color", description = "Change the color of the chat background.", - category = "General", - allowAlpha = false + category = "General" + ) + var chatBackgroundColor = Color(0, 0, 0, 128) + + @Property( + type = PropertyType.COLOR, + name = "Copy Chat Message Background Color", + description = "Change the color of chat messages that are ready to copy.", + category = "General" ) - var chatBackgroundColor = Color(0, 0, 0, 50) + var hoveredChatBackgroundColor = Color(80, 80, 80, 128) @Property( type = PropertyType.SWITCH, @@ -179,7 +186,7 @@ object ChattingConfig : Vigilant(File(Chatting.modDir, "${Chatting.ID}.toml"), C chatTabs = funny ChatTabs.initialize() if (!funny) { - val dummy = ChatTab(true, "ALL", false, null, null, null, null, null, "") + val dummy = ChatTab(true, "ALL", false, null, null, null, null, null, null, null, null, null, null, "") dummy.initialize() ChatTabs.currentTab = dummy } else { diff --git a/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt b/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt index f761a9a..9863936 100644 --- a/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt +++ b/src/main/kotlin/cc/woverflow/chatting/gui/components/CleanButton.kt @@ -1,7 +1,8 @@ package cc.woverflow.chatting.gui.components import cc.woverflow.chatting.Chatting -import cc.woverflow.chatting.utils.drawBorderedString +import cc.woverflow.chatting.hook.GuiNewChatHook +import cc.woverflow.onecore.utils.drawBorderedString import club.sk1er.patcher.config.PatcherConfig import net.minecraft.client.Minecraft import net.minecraft.client.gui.GuiButton @@ -65,7 +66,7 @@ open class CleanButton(buttonId: Int, private val x: () -> Int, private val y: ( drawCenteredString(fontrenderer, displayString, xPosition + width / 2, yPosition + (height - 8) / 2, j) } RenderType.FULL -> { - fontrenderer.drawBorderedString(displayString, (xPosition + width / 2) - (fontrenderer.getStringWidth(displayString) / 2), yPosition + (height - 8) / 2, j) + fontrenderer.drawBorderedString(displayString, (xPosition + width / 2) - (fontrenderer.getStringWidth(displayString) / 2), yPosition + (height - 8) / 2, j, (Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).textOpacity) } } } diff --git a/src/main/kotlin/cc/woverflow/chatting/utils/ModCompatHooks.kt b/src/main/kotlin/cc/woverflow/chatting/utils/ModCompatHooks.kt index 2f21429..8f73f2c 100644 --- a/src/main/kotlin/cc/woverflow/chatting/utils/ModCompatHooks.kt +++ b/src/main/kotlin/cc/woverflow/chatting/utils/ModCompatHooks.kt @@ -5,6 +5,8 @@ import com.llamalad7.betterchat.BetterChat import cc.woverflow.chatting.Chatting.isBetterChat import cc.woverflow.chatting.Chatting.isPatcher import cc.woverflow.chatting.config.ChattingConfig.textRenderType +import cc.woverflow.chatting.hook.GuiNewChatHook +import cc.woverflow.onecore.utils.drawBorderedString import net.minecraft.client.Minecraft import net.minecraft.client.gui.FontRenderer @@ -37,7 +39,7 @@ object ModCompatHooks { fontRenderer.drawString(text, x, y, color, false) } 2 -> { - fontRenderer.drawBorderedString(text, x.toInt(), y.toInt(), color) + fontRenderer.drawBorderedString(text, x.toInt(), y.toInt(), color, (Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).textOpacity) } else -> fontRenderer.drawString(text, x, y, color, true) } diff --git a/src/main/kotlin/cc/woverflow/chatting/utils/renderutils.kt b/src/main/kotlin/cc/woverflow/chatting/utils/renderutils.kt index 07fa2d3..393cc74 100644 --- a/src/main/kotlin/cc/woverflow/chatting/utils/renderutils.kt +++ b/src/main/kotlin/cc/woverflow/chatting/utils/renderutils.kt @@ -3,9 +3,6 @@ package cc.woverflow.chatting.utils import cc.woverflow.chatting.config.ChattingConfig -import cc.woverflow.chatting.hook.GuiNewChatHook -import net.minecraft.client.Minecraft -import net.minecraft.client.gui.FontRenderer import net.minecraft.client.renderer.GlStateManager import net.minecraft.client.renderer.texture.TextureUtil import net.minecraft.client.shader.Framebuffer @@ -24,11 +21,6 @@ import java.nio.ByteBuffer import java.nio.ByteOrder import javax.imageio.ImageIO -var bypassNameHighlight = false - private set - -private val regex = Regex("(?i)\\u00A7[0-9a-f]") - /** * Taken from https://github.com/Moulberry/HyChat */ @@ -214,31 +206,4 @@ fun Framebuffer.screenshot(file: File): BufferedImage { } } return bufferedimage -} - -/** - * Taken from https://github.com/Moulberry/HyChat - */ -fun FontRenderer.drawBorderedString(text: String, - x: Int, - y: Int, - color: Int): Int { - val noColors = text.replace(regex, "\u00A7r") - var yes = 0 - if (((Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).textOpacity / 4) > 3) { - bypassNameHighlight = true - for (xOff in -2..2) { - for (yOff in -2..2) { - if (xOff * xOff != yOff * yOff) { - yes += drawString( - noColors, - (xOff / 2f) + x, (yOff / 2f) + y, ((Minecraft.getMinecraft().ingameGUI.chatGUI as GuiNewChatHook).textOpacity / 4) shl 24, false - ) - } - } - } - bypassNameHighlight = false - } - yes += drawString(text, x, y, color) - return yes }
\ No newline at end of file diff --git a/src/main/resources/assets/chatting/delete.png b/src/main/resources/assets/chatting/delete.png Binary files differnew file mode 100644 index 0000000..81de387 --- /dev/null +++ b/src/main/resources/assets/chatting/delete.png diff --git a/src/main/resources/assets/chatting/reply.png b/src/main/resources/assets/chatting/reply.png Binary files differnew file mode 100644 index 0000000..f3d76e6 --- /dev/null +++ b/src/main/resources/assets/chatting/reply.png diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 8b9aff4..46cce6c 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -4,13 +4,13 @@ "name": "${name}", "description": "A chat mod.", "version": "${version}", - "mcversion": "${mcversion}", + "mcversion": "1.8.9", "url": "", "updateUrl": "", "authorList": [ "W-OVERFLOW" ], - "credits": "Mo2men#2806 for copy and screenshot images.", + "credits": "Mo2men#2806 for chat icons, Pablo", "logoFile": "", "screenshots": [], "dependencies": [] |