diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d4a420f..62008db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,15 +23,11 @@ jobs: with: fetch-depth: 10 - - name: Set up JDK 8, 16, 17, 21 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: + java-version: 21 distribution: temurin - java-version: | - 8 - 16 - 17 - 21 - uses: actions/cache@v4 with: @@ -48,4 +44,4 @@ jobs: run: chmod +x ./gradlew - name: Build - run: ./gradlew build --no-daemon + run: ./gradlew build --no-daemon \ No newline at end of file diff --git a/.github/workflows/mod_project_integration.yml b/.github/workflows/mod_project_integration.yml deleted file mode 100644 index ddd613b..0000000 --- a/.github/workflows/mod_project_integration.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Mod-Project Integration - -on: - issues: - types: [opened] - pull_request: - types: [opened] - -jobs: - add-to-project: - name: Add issue/PR to project - runs-on: ubuntu-latest - steps: - - uses: actions/add-to-project@v1.0.2 - with: - project-url: https://github.com/orgs/Polyfrost/projects/9 - github-token: ${{ secrets.ADD_TO_PROJECT_PAT }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 74b86e0..83a75d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ # eclipse -eclipse bin *.launch .settings @@ -9,7 +8,6 @@ bin # idea out -classes *.ipr *.iws *.iml @@ -19,12 +17,376 @@ classes build .gradle -#Netbeans -.nb-gradle -.nb-gradle-properties - # other +eclipse run +build - Copy.gradle +.vscode +.devauth +.DS_STORE + + +# Created by https://www.toptal.com/developers/gitignore/api/java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Eclipse Patch ### +# Spring Boot Tooling +.sts4-cache/ + +### ForgeGradle ### +# Minecraft client/server files +run/ + +### Intellij ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### Intellij Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +# https://plugins.jetbrains.com/plugin/7973-sonarlint +.idea/**/sonarlint/ + +# SonarQube Plugin +# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin +.idea/**/sonarIssues.xml + +# Markdown Navigator plugin +# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced +.idea/**/markdown-navigator.xml +.idea/**/markdown-navigator-enh.xml +.idea/**/markdown-navigator/ + +# Cache file creation bug +# See https://youtrack.jetbrains.com/issue/JBR-2257 +.idea/$CACHE_FILE$ + +# CodeStream plugin +# https://plugins.jetbrains.com/plugin/12206-codestream +.idea/codestream.xml + +# Azure Toolkit for IntelliJ plugin +# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij +.idea/**/azureSettings.xml + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff + +# AWS User-specific + +# Generated files + +# Sensitive or high-churn files + +# Gradle + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake + +# Mongo Explorer plugin + +# File-based project format + +# IntelliJ + +# mpeltonen/sbt-idea plugin + +# JIRA plugin + +# Cursive Clojure plugin + +# SonarLint plugin + +# Crashlytics plugin (for Android Studio and IntelliJ) + +# Editor-based Rest Client + +# Android studio 3.1+ serialized cache file + +### Intellij+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Java ### +# Compiled class file +*.class + +# Log file +*.log + +# BlueJ files +*.ctxt + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.nar +*.ear +*.zip +*.tar.gz +*.rar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* +replay_pid* + +### Kotlin ### +# Compiled class file + +# Log file + +# BlueJ files + +# Mobile Tools for Java (J2ME) + +# Package Files # + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml + +### macOS ### +# General .DS_Store -Thumbs.db -.vscode \ No newline at end of file +.AppleDouble +.LSOverride + +# Icon must end with two \r + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +# Support for Project snippet scope +.vscode/*.code-snippets + +# Ignore code-workspaces +*.code-workspace + +### Gradle ### +.gradle +**/build/ +!src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# End of https://www.toptal.com/developers/gitignore/api/java,gradle,forgegradle,kotlin,macos,intellij,intellij+all,eclipse,visualstudiocode diff --git a/build.gradle.kts b/build.gradle.kts index f4acb5e..af5c3a2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,26 +10,25 @@ plugins { id("dev.deftu.gradle.tools.resources") // Applies resource processing so that we can replace tokens, such as our mod name/version, in our resources. id("dev.deftu.gradle.tools.bloom") // Applies the Bloom plugin, which allows us to replace tokens in our source files, such as being able to use `@MOD_VERSION` in our source files. id("dev.deftu.gradle.tools.shadow") // Applies the Shadow plugin, which allows us to shade our dependencies into our mod JAR. This is NOT recommended for Fabric mods, but we have an *additional* configuration for those! - id("dev.deftu.gradle.tools.ducks") // Creates a ducks source set, which allows us to use theoretical classes which may not exist at runtime (such as things which are in other mods). id("dev.deftu.gradle.tools.minecraft.loom") // Applies the Loom plugin, which automagically configures Essential's Architectury Loom plugin for you. id("dev.deftu.gradle.tools.minecraft.releases") // Applies the Minecraft auto-releasing plugin, which allows you to automatically release your mod to CurseForge and Modrinth. } toolkitLoomHelper { useOneConfig { - version = "1.0.0-alpha.106" - loaderVersion = "1.1.0-alpha.46" - + version = "1.0.0-alpha.166" + loaderVersion = "1.1.0-alpha.49" usePolyMixin = true - polyMixinVersion = "0.8.4+build.2" - + polyMixinVersion = "0.8.4+build.6" applyLoaderTweaker = true - for (module in arrayOf("commands", "config", "config-impl", "events", "internal", "ui", "utils")) { +module } } + useDevAuth("1.2.1") + useMixinExtras("0.5.0") + // Turns off the server-side run configs, as we're building a client-sided mod. disableRunConfigs(GameSide.SERVER) @@ -42,8 +41,4 @@ toolkitLoomHelper { // Configures the Mixin tweaker if we are building for Forge. useForgeMixin(modData.id) } -} - -dependencies { - implementation(shade("com.github.ben-manes.caffeine:caffeine:2.9.3")!!) } \ No newline at end of file diff --git a/docs/chattabs.md b/docs/chattabs.md deleted file mode 100644 index ca2740d..0000000 --- a/docs/chattabs.md +++ /dev/null @@ -1,256 +0,0 @@ -# Chatting Chat Tabs - -## Syntax - -The file for Chat Tabs is in `{MINECRAFT DIRECTORY}/OneConfig/profiles/{PROFILE}/chattabs.json`. However, Chatting versions below 1.4.2-beta5 use `{MINECRAFT DIRECTORY}/W-OVERFLOW/Chatting/chattabs.json`. The default file will look -something like this: - -```json -{ - "tabs": [ - { - "enabled": true, - "name": "ALL", - "unformatted": false, - "lowercase": false, - "color": 14737632, - "hovered_color": 16777120, - "selected_color": 10526880 - }, - { - "enabled": true, - "name": "PARTY", - "unformatted": false, - "lowercase": false, - "starts": [ - "§r§9Party §8> ", - "§r§9P §8> ", - "§eThe party was transferred to §r", - "§eKicked §r" - ], - "contains": [ - "§r§ehas invited you to join their party!" - ], - "ends": [ - "§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>)+(.*)" - ], - "color": 14737632, - "hovered_color": 16777120, - "selected_color": 10526880, - "prefix": "/pc " - }, - { - "enabled": true, - "name": "GUILD", - "unformatted": true, - "lowercase": false, - "starts": [ - "Guild >", - "G >" - ], - "color": 14737632, - "hovered_color": 16777120, - "selected_color": 10526880, - "prefix": "/gc " - }, - { - "enabled": true, - "name": "PM", - "unformatted": false, - "lowercase": false, - "regex": [ - "^(?§dTo|§dFrom) (?.+): §r(?§7.*)(?:§r)?$" - ], - "color": 14737632, - "hovered_color": 16777120, - "selected_color": 10526880, - "prefix": "/r " - } - ], - "version": 6 -} -``` - -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 current version is `4` -. - -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" - ], - "contains": [ - "§r§ehas invited you to join their party!" - ], - "ends": [ - "§r§eto the party! They have §r§c60 §r§eseconds to accept.§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])*\\[(...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>)+(.*)" - ], - "color": 14737632, - "hovered_color": 16777120, - "selected_color": 10526880, - "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 `contains` property allows you to only allow a message if it contains a string in the `contains` 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 `color` property allows you to change the color of the chat tab text. It is in RGBA format. - -The `hovered_color` property allows you to change the color of the chat tab text while being hovered. This takes -priority over the `color` property. Like the `color` property, it is in RGBA format. - -The `selected_color` property allows you to change the color of the chat tab text while selected. This takes priority -over all the other color properties. Like the other color properties, it is in RGBA format. - -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. This is no longer required as of version 5. - -The `lowercase` property makes the message trigger lowercase. - -## Chat Tabs JSON Changelogs - -### Version 6 (Chatting 1.4.2 beta5) -- Changed PM tab to use regex instead of starts and sets `unformatted` to false -- Changed directory of Chat Tabs JSON to `{MINECRAFT DIRECTORY}/OneConfig/profiles/{PROFILE}/chattabs.json` - -### Version 5 (Chatting 1.4.0 [04363f5]) -- The `prefix` property is no longer a required property. -- Added `lowercase` property - -### Version 4 (Chatting 1.4.0 [eece3cb]) -- Added color text options (`color`, `hovered_color`, and `selected_color`) -- `version` is now actually an integer - -### Version 3 (Chatting 1.4.0-alpha1) -- Added `ignore_` options (`ignore_starts`, `ignore_ends`, `ignore_equals`, and `ignore_regex`) - -### Version 2 (1.0.0) -- Added `enabled` property \ No newline at end of file diff --git a/docs/docs.md b/docs/docs.md deleted file mode 100644 index b7ff82a..0000000 --- a/docs/docs.md +++ /dev/null @@ -1,3 +0,0 @@ -# Chatting Docs - -## - [Chat Tabs](chattabs.md) \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 74dc189..83481a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,18 @@ -# Gradle Configuration -- DO NOT TOUCH THESE VALUES.` +# Gradle Configuration -- DO NOT TOUCH THESE VALUES. org.gradle.daemon=true org.gradle.parallel=true org.gradle.configureoncommand=true org.gradle.parallel.threads=4 org.gradle.jvmargs=-Xmx2G +loom.ignoreDependencyLoomVersionValidation=true +# gradle.properties file -- CHANGE THE VALUES STARTING WITH `mod.*` AND REMOVE THIS COMMENT. + +# Sets the name of your mod. mod.name=Chatting +# Sets the ID of your mod that mod loaders use to recognize it. mod.id=chatting -mod.version=2.0.7 +# Sets the version of your mod. Make sure to update this when you make changes according to the SemVer specification. +mod.version=1.0.0 +# Sets the Maven group ID of your mod. This is effectively unused but is good practice to set regardless. mod.group=org.polyfrost \ No newline at end of file diff --git a/gradlew b/gradlew index 1aa94a4..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/root.gradle.kts b/root.gradle.kts index c548169..a180096 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -3,16 +3,22 @@ plugins { } preprocess { - // Adding new versions/loaders can be done like so: - // For each version, we add a new wrapper around the last from highest to lowest. - // Each mod loader needs to link up to the previous version's mod loader so that the mappings can be processed from the previous version. - // "1.12.2-forge"(11202, "srg") { - // "1.8.9-forge"(10809, "srg") - // } - - "1.8.9-forge"(10809, "srg") { - "1.8.9-fabric"(10809, "yarn") + "1.21.5-fabric"(1_21_05, "yarn") { + "1.21.4-fabric"(1_21_04, "yarn") { + "1.21.1-fabric"(1_21_01, "yarn") { + "1.16.5-fabric"(1_16_05, "yarn", file("versions/mappings/1.21.1-fabric+1.16.5-fabric.txt")) { + "1.16.5-forge"(1_16_05, "srg") { + "1.12.2-forge"(1_12_02, "srg", file("versions/mappings/1.16.5-forge+1.12.2-forge.txt")) { + "1.12.2-fabric"(1_12_02, "yarn") { + "1.8.9-fabric"(1_08_09, "yarn") { + "1.8.9-forge"(1_08_09, "srg") + } + } + } + } + } + } + } } - strictExtraMappings.set(true) -} +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 1c2a298..7b7d6a3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,10 +1,8 @@ -@file:Suppress("PropertyName") - import groovy.lang.MissingPropertyException pluginManagement { repositories { - // Releases + // Repositories maven("https://maven.deftu.dev/releases") maven("https://maven.fabricmc.net") maven("https://maven.architectury.dev/") @@ -17,35 +15,47 @@ pluginManagement { maven("https://maven.deftu.dev/snapshots") mavenLocal() - // Default + // Default repositories gradlePluginPortal() mavenCentral() } plugins { - kotlin("jvm") version("2.0.10") - id("dev.deftu.gradle.multiversion-root") version("2.35.0") + kotlin("jvm") version ("2.2.10") + id("dev.deftu.gradle.multiversion-root") version ("2.55.0") } } val projectName: String = extra["mod.name"]?.toString() ?: throw MissingPropertyException("mod.name has not been set.") - -// Configures the root project Gradle name based on the value in `gradle.properties` rootProject.name = projectName + rootProject.buildFileName = "root.gradle.kts" // Adds all of our build target versions to the classpath if we need to add version-specific code. -// Update this list if you want to remove/add a version and/or mod loader. -// The format is: version-modloader (f.ex: 1.8.9-forge, 1.17.1-fabric, etc) -// **REMEMBER TO ALSO UPDATE THE `root.gradle.kts` AND `build.gradle.kts` FILES WITH THE NEW VERSION(S). listOf( "1.8.9-forge", - "1.8.9-fabric" + "1.8.9-fabric", + + "1.12.2-fabric", + "1.12.2-forge", + + "1.16.5-forge", + "1.16.5-fabric", + + "1.21.1-fabric", + + "1.21.4-fabric", + + "1.21.5-fabric", + +// "1.21.8-fabric", + +// "1.21.9-fabric", ).forEach { version -> include(":$version") project(":$version").apply { projectDir = file("versions/$version") buildFileName = "../../build.gradle.kts" } -} +} \ No newline at end of file diff --git a/src/ducks/java/club/sk1er/patcher/config/OldPatcherConfig.java b/src/ducks/java/club/sk1er/patcher/config/OldPatcherConfig.java deleted file mode 100644 index 91e13bb..0000000 --- a/src/ducks/java/club/sk1er/patcher/config/OldPatcherConfig.java +++ /dev/null @@ -1,7 +0,0 @@ -package club.sk1er.patcher.config; - -public class OldPatcherConfig { - public static boolean transparentChat; // Chatting - public static boolean transparentChatOnlyWhenClosed; // Chatting - public static boolean transparentChatInputField; // Chatting -} diff --git a/src/ducks/java/club/sk1er/patcher/config/PatcherConfig.java b/src/ducks/java/club/sk1er/patcher/config/PatcherConfig.java deleted file mode 100644 index 1472f85..0000000 --- a/src/ducks/java/club/sk1er/patcher/config/PatcherConfig.java +++ /dev/null @@ -1,8 +0,0 @@ -package club.sk1er.patcher.config; - -public class PatcherConfig { - public static boolean transparentChatInputField; - public static boolean transparentChat; - public static boolean chatPosition; - public static boolean extendedChatLength; -} diff --git a/src/ducks/java/com/llamalad7/betterchat/BetterChat.java b/src/ducks/java/com/llamalad7/betterchat/BetterChat.java deleted file mode 100644 index 14a5a70..0000000 --- a/src/ducks/java/com/llamalad7/betterchat/BetterChat.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.llamalad7.betterchat; - -public class BetterChat { - public static ChatSettings getSettings() { - throw new AssertionError("Wyvest"); - } -} diff --git a/src/ducks/java/com/llamalad7/betterchat/ChatSettings.java b/src/ducks/java/com/llamalad7/betterchat/ChatSettings.java deleted file mode 100644 index d6f73b1..0000000 --- a/src/ducks/java/com/llamalad7/betterchat/ChatSettings.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.llamalad7.betterchat; - -public class ChatSettings { - public int xOffset; - public int yOffset; - public boolean smooth; -} diff --git a/src/main/java/org/polyfrost/chatting/hook/ChatHook.java b/src/main/java/org/polyfrost/chatting/hook/ChatHook.java deleted file mode 100644 index 78e150a..0000000 --- a/src/main/java/org/polyfrost/chatting/hook/ChatHook.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.polyfrost.chatting.hook; - -import net.minecraft.client.gui.ChatLine; - -public class ChatHook { - public static ChatLine currentLine = null; - public static boolean lineVisible = false; -} \ No newline at end of file diff --git a/src/main/java/org/polyfrost/chatting/hook/ChatLineHook.java b/src/main/java/org/polyfrost/chatting/hook/ChatLineHook.java deleted file mode 100644 index 63e8563..0000000 --- a/src/main/java/org/polyfrost/chatting/hook/ChatLineHook.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.polyfrost.chatting.hook; - -import net.minecraft.client.gui.ChatLine; -import net.minecraft.client.network.NetworkPlayerInfo; - -import java.lang.ref.WeakReference; -import java.util.HashSet; - -public interface ChatLineHook { - HashSet> chatting$chatLines = new HashSet<>(); - boolean chatting$hasDetected(); - NetworkPlayerInfo chatting$getPlayerInfo(); - - void chatting$updatePlayerInfo(); - - long chatting$getUniqueId(); - - ChatLine chatting$getFullMessage(); -} diff --git a/src/main/java/org/polyfrost/chatting/hook/GuiChatHook.java b/src/main/java/org/polyfrost/chatting/hook/GuiChatHook.java deleted file mode 100644 index 36e0f48..0000000 --- a/src/main/java/org/polyfrost/chatting/hook/GuiChatHook.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.polyfrost.chatting.hook; - -public interface GuiChatHook { - void chatting$triggerButtonReset(); -} diff --git a/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java b/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java deleted file mode 100644 index fda701f..0000000 --- a/src/main/java/org/polyfrost/chatting/hook/GuiNewChatHook.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.polyfrost.chatting.hook; - -import net.minecraft.client.gui.ChatLine; - -public interface GuiNewChatHook { - int chatting$getRight(); - - boolean chatting$isHovering(); - - ChatLine chatting$getHoveredLine(int mouseY); - - String chatting$getChattingChatComponent(int mouseY, int mouseButton); - - int chatting$getTextOpacity(); -} diff --git a/src/main/java/org/polyfrost/chatting/mixin/ChatAccessor.java b/src/main/java/org/polyfrost/chatting/mixin/ChatAccessor.java new file mode 100644 index 0000000..0439bb7 --- /dev/null +++ b/src/main/java/org/polyfrost/chatting/mixin/ChatAccessor.java @@ -0,0 +1,21 @@ +package org.polyfrost.chatting.mixin; + +import net.minecraft.client.gui.hud.ChatHud; +import net.minecraft.client.gui.hud.ChatHudLine; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import java.util.List; + +@Mixin(ChatHud.class) +public interface ChatAccessor { + + @Accessor + List< + ChatHudLine + //#if MC == 11605 + //$$ + //#endif + > getMessages(); + +} diff --git a/src/main/java/org/polyfrost/chatting/mixin/ChatLineMixin.java b/src/main/java/org/polyfrost/chatting/mixin/ChatLineMixin.java index ea43146..47145e7 100644 --- a/src/main/java/org/polyfrost/chatting/mixin/ChatLineMixin.java +++ b/src/main/java/org/polyfrost/chatting/mixin/ChatLineMixin.java @@ -1,146 +1,22 @@ -/* - * This file is from chat_heads is licensed under MPL-2.0, which can be found at https://www.mozilla.org/en-US/MPL/2.0/ - * See: https://github.com/dzwdz/chat_heads/blob/fabric-1.16.x/LICENSE - */ - package org.polyfrost.chatting.mixin; -import org.apache.commons.lang3.StringUtils; -import org.polyfrost.chatting.config.ChattingConfig; -import org.polyfrost.chatting.hook.ChatHook; +import net.minecraft.client.gui.hud.ChatHudLine; +import org.polyfrost.chatting.component.PlayerHead; import org.polyfrost.chatting.hook.ChatLineHook; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ChatLine; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.util.IChatComponent; -import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import java.lang.ref.WeakReference; -import java.util.HashMap; -import java.util.Map; -import java.util.regex.Pattern; -@Mixin(ChatLine.class) +@Mixin(ChatHudLine.class) public class ChatLineMixin implements ChatLineHook { - @Unique - private boolean chatting$detected = false; - @Unique - private boolean chatting$first = true; - @Unique - private NetworkPlayerInfo chatting$playerInfo; - @Unique - private NetworkPlayerInfo chatting$detectedPlayerInfo; - @Unique - private static NetworkPlayerInfo chatting$lastPlayerInfo; - @Unique - private static long chatting$lastUniqueId = 0; - @Unique - private long chatting$uniqueId = 0; - @Unique - private ChatLine chatting$fullMessage = null; - @Unique - private static ChatLine chatting$lastChatLine = null; - @Unique - private static final Pattern chatting$pattern = Pattern.compile("(§.)|\\W"); - - @Inject(method = "", at = @At("RETURN")) - private void onInit(int i, IChatComponent iChatComponent, int chatId, CallbackInfo ci) { - chatting$lastUniqueId++; - chatting$uniqueId = chatting$lastUniqueId; - chatting$fullMessage = ChatHook.currentLine; - if (chatting$lastChatLine == ChatHook.currentLine) { - if (chatting$lastPlayerInfo != null) { - return; - } - } - chatting$lastChatLine = chatting$fullMessage; - chatting$chatLines.add(new WeakReference<>((ChatLine) (Object) this)); - NetHandlerPlayClient netHandler = Minecraft.getMinecraft().getNetHandler(); - if (netHandler == null) return; - Map nicknameCache = new HashMap<>(); - try { - for (String word : chatting$pattern.split(StringUtils.substringBefore(iChatComponent.getFormattedText(), ":"))) { - if (word.isEmpty()) continue; - chatting$playerInfo = netHandler.getPlayerInfo(word); - if (chatting$playerInfo == null) { - chatting$playerInfo = chatting$getPlayerFromNickname(word, netHandler, nicknameCache); - } - if (chatting$playerInfo != null) { - chatting$detectedPlayerInfo = chatting$playerInfo; - chatting$detected = true; - if (ChatHook.lineVisible) { - if (chatting$lastPlayerInfo != null && chatting$playerInfo.getGameProfile() == chatting$lastPlayerInfo.getGameProfile()) { - chatting$first = false; - if (ChattingConfig.INSTANCE.getHideChatHeadOnConsecutiveMessages()) { - chatting$playerInfo = null; - } - } - chatting$lastPlayerInfo = chatting$detectedPlayerInfo; - } - return; - } - } - } catch (Exception e) { - e.printStackTrace(); - } - } @Unique - @Nullable - private static NetworkPlayerInfo chatting$getPlayerFromNickname(String word, NetHandlerPlayClient connection, Map nicknameCache) { - if (nicknameCache.isEmpty()) { - for (NetworkPlayerInfo p : connection.getPlayerInfoMap()) { - IChatComponent displayName = p.getDisplayName(); - if (displayName != null) { - String nickname = displayName.getUnformattedTextForChat(); - if (word.equals(nickname)) { - nicknameCache.clear(); - return p; - } - - nicknameCache.put(nickname, p); - } - } - } else { - // use prepared cache - return nicknameCache.get(word); - } - - return null; - } - - @Override - public boolean chatting$hasDetected() { - return chatting$detected; - } - - @Override - public NetworkPlayerInfo chatting$getPlayerInfo() { - return chatting$playerInfo; - } - - @Override - public void chatting$updatePlayerInfo() { - if (ChattingConfig.INSTANCE.getHideChatHeadOnConsecutiveMessages() && !chatting$first) { - chatting$playerInfo = null; - } else { - chatting$playerInfo = chatting$detectedPlayerInfo; - } - } + private PlayerHead chatting$head; - @Override - public long chatting$getUniqueId() { - return chatting$uniqueId; + public PlayerHead chatting$getChatHead() { + return chatting$head; } - @Override - public ChatLine chatting$getFullMessage() { - return chatting$fullMessage; + public void chatting$setChatHead(PlayerHead chatting$head) { + this.chatting$head = chatting$head; } -} +} \ No newline at end of file diff --git a/src/main/java/org/polyfrost/chatting/mixin/ChatMixin.java b/src/main/java/org/polyfrost/chatting/mixin/ChatMixin.java new file mode 100644 index 0000000..5880ad7 --- /dev/null +++ b/src/main/java/org/polyfrost/chatting/mixin/ChatMixin.java @@ -0,0 +1,129 @@ +package org.polyfrost.chatting.mixin; + +import net.minecraft.client.gui.hud.ChatHud; +import net.minecraft.client.gui.hud.ChatHudLine; +import net.minecraft.text.Style; +import org.jetbrains.annotations.NotNull; +import org.polyfrost.chatting.core.McChat; +import org.polyfrost.chatting.core.Util; +import org.polyfrost.chatting.hook.ChatHook; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.ModifyArgs; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.invoke.arg.Args; + +import java.util.Collection; +import java.util.List; + +//#if MC <= 1.16.5 +//$$ import net.minecraft.text.Text; +//#endif + +@Mixin(net.minecraft.client.gui.hud.ChatHud.class) +public abstract class ChatMixin implements ChatHook { + + @Inject( + //#if MC <= 1.12.2 + //$$ method = "drawChat", + //#else + method = "render", + //#endif + at = @At("HEAD"), cancellable = true + ) + private void cancelRender(CallbackInfo ci) { + ci.cancel(); + } + + @Shadow + @Final + private List< + ChatHudLine + //#if MC == 11605 + //$$ + //#endif + > messages; + + //#if MC > 1.16.5 + @ModifyArgs(method = "addMessage(Lnet/minecraft/client/gui/hud/ChatHudLine;)V", at = @At(value = "INVOKE", target = "Ljava/util/List;add(ILjava/lang/Object;)V")) + //#else + //$$ @ModifyArgs( + //#if MC <= 1.12.2 + //$$ method = "setChatLine", + //#else + //$$ method = "addMessage(Lnet/minecraft/util/text/ITextComponent;IIZ)V", + //#endif + //$$ at = @At(value = "INVOKE", target = "Ljava/util/List;add(ILjava/lang/Object;)V", ordinal = 1) + //$$ ) + //#endif + private void onAdd(Args args) { + McChat.INSTANCE.addMessage(args.get(1)); + } + + //#if MC > 1.16.5 + @Inject(method = "restoreChatState", at = @At(value = "TAIL")) + private void onRestore(ChatHud.ChatState chatState, CallbackInfo ci) { + McChat.INSTANCE.refreshChat(); + } + + @Inject(method = "queueForRemoval", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;refresh()V")) + private void onRemoval(net.minecraft.network.message.MessageSignatureData messageSignatureData, CallbackInfoReturnable cir) { + McChat.INSTANCE.refreshChat(); + } + + @Inject(method = "getIndicatorAt", at = @At("HEAD"), cancellable = true) + private void onGetIndicatorAt(double d, double e, CallbackInfoReturnable cir) { + cir.setReturnValue(Util.getIndicatorAt()); + } + //#else + //$$ @Inject(method = "removeMessage", at = @At("HEAD")) + //$$ private void onRemoval(int i, CallbackInfo ci) { + //$$ McChat.INSTANCE.removeMessageById(i); + //$$ } + //#endif + + @Inject(method = "clear", at = @At("HEAD")) + private void onClear(CallbackInfo ci) { + McChat.INSTANCE.clearMessages(); + } + + @Override + public void chatting$deleteChatLine( + //#if MC <= 1.16.5 + //$$ @NotNull Collection + //#endif + //$$ > + //#else + @NotNull Collection<@NotNull ChatHudLine> + //#endif + chatLines + ) { + this.messages.removeAll(chatLines); + } + + //#if MC >= 1.16.5 + @Inject(method = "getTextStyleAt", at = @At("HEAD"), cancellable = true) + private void onGetStyle(double d, double e, CallbackInfoReturnable