├── .gitignore ├── LICENSE.txt ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java └── cn │ └── liqing │ └── mousedanmu │ ├── DanmuColorPicker.java │ ├── DanmuConverter.java │ ├── ModConfig.java │ ├── ModMenuIntegration.java │ ├── MouseDanmu.java │ ├── MouseDanmuClient.java │ ├── SuperChatManager.java │ └── command │ ├── MouseDanmuCommand.java │ └── argument │ └── RoomIdArgumentType.java └── resources ├── assets └── mousedanmu │ ├── icon.png │ └── lang │ ├── en_us.json │ └── zh_cn.json └── fabric.mod.json /.gitignore: -------------------------------------------------------------------------------- 1 | /run/ 2 | /.gradle/ 3 | /.idea/ 4 | /build/ 5 | /out/ 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 立青 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 鼠鼠弹幕 2 | ![license](https://img.shields.io/github/license/LiQing-Code/mouse-danmu) 3 | ![version](https://img.shields.io/github/v/release/liqing-code/mouse-danmu) 4 | ![downloads](https://img.shields.io/github/downloads/liqing-code/mouse-danmu/total) 5 | 6 | 用于显示哔哩哔哩直播弹幕的《我的世界》Fabric MOD 7 | 8 | ## 代码托管 9 | - [Github](https://github.com/LiQing-Code/mouse-danmu) 10 | - [码云](https://gitee.com/LiQing-Code/mouse-danmu) 11 | 12 | ## 特点 13 | - 自定义弹幕颜色 14 | - 自定义要显示的信息 15 | - BoosBar显示醒目留言 16 | - 贴近官方风格 17 | 18 | ## 前置 19 | 20 | - 我的世界 >= 1.19 21 | - [Cloth Config](https://github.com/shedaniel/cloth-config) >= 8.3.115 22 | - [可选,推荐安装] [ModMenu](https://github.com/TerraformersMC/ModMenu) >= 4.0.0 23 | 安装这个以后才能打开MOD选项 24 | 25 | ## 安装 26 | 27 | 点击[下载](https://github.com/LiQing-Code/mouse-danmu/releases/latest) 28 | 29 | 可以看看这个视频 [Mod新手教程](https://www.bilibili.com/video/BV1cX4y1T7RZ) 30 | 31 | ## 使用说明 32 | 33 | [视频教程](https://www.bilibili.com/video/BV1e887e3EV8) 34 | 35 | 安装完成以后游戏中会添加一个 `/mousedanmu` 命令,用来控制直播间操作。 36 | 37 | 嫌 `/mousedanmu` 这个命令太长的话,可以使用 `/dm` 这个重定向命令,使用时会重定向到 `/mousedanmu` 38 | 39 | 下面的操作都将使用 `/dm` 这个重定向命令 40 | 41 | 在游戏中按`T`键打开聊天框,输入下列命令就能执行。 42 | 43 | ### 命令列表 44 | 45 | - `/dm connect ` 连接一个直播间 `` 为直播间号 46 | 47 | 列如:`/dm connect 24256088` 就能连接到[我的直播间](https://live.bilibili.com/24256088)了 48 | 49 | - `/dm close` 断开直播间 50 | - `/dm status` 查看直播间连接状态 51 | - `/dm test []` 显示一些测试弹幕 `[]` 是一个可选参数,单位是毫秒,默认是500毫秒,用于控制测试弹幕发送间隔 52 | 53 | 列如 `/dm test 1000` 就是每秒发送一条测试弹幕 54 | 55 | - `/dm ` 发送弹幕(需要Cookie) `` 是要发送的内容 56 | 57 | 列如 `/dm 哈哈哈 真好玩` 就会向当前直播间发送`哈哈哈 真好玩` 58 | ## 更多 59 | 60 | 部分直播间 roomId 是会重定向的,列如直播间 https://live.bilibili.com/1 需要在浏览器中打开,然后按F12打开开发者工具,找到控制台执行以下代码,就能获取到真实roomId 61 | ```javascript 62 | window.__NEPTUNE_IS_MY_WAIFU__.roomInitRes.data.room_id 63 | ``` 64 | 65 | 66 | 英文语言文件不可用状态,欢迎有能力的人补充语言文件,更欢迎大家参与开发 67 | 68 | 如果遇到问题可以提交 [issues](https://github.com/LiQing-Code/mouse-danmu/issues) 或到[QQ群](https://jq.qq.com/?_wv=1027&k=nImOUpnV)反馈 69 | 70 | 表情弹幕是可以点击打开网页查看的,用户名也可以点击查看主页 71 | 72 | 项目依赖的库 [bili-live-danmu](https://github.com/LiQing-Code/bili-live-danmu) 73 | 74 | ## 免责声明 75 | 76 | 本模组用于获取哔哩哔哩直播的弹幕并在《我的世界》游戏聊天框中显示,提供了使用用户Cookie获取弹幕信息及发送弹幕的功能。 77 | 78 | 请注意: 79 | 1. 使用用户Cookie获取弹幕信息或发送弹幕,可能存在被哔哩哔哩封禁账号的风险,尽管目前尚无明确案例。 80 | 2. 如果在使用本模组时进行《我的世界》直播,尽管游戏聊天框显示的弹幕来自哔哩哔哩,但不合规的弹幕可能导致直播间被封禁。 81 | 82 | 使用本模组即表示您理解并接受以上风险,开发者不对因使用本模组导致的任何账号或直播间封禁承担责任。 83 | 84 | ## 截图 85 | ![效果演示](https://user-images.githubusercontent.com/51829935/206930179-9e6a5419-0127-4cf3-9f36-7554a66e448a.png) 86 | ![选项界面](https://user-images.githubusercontent.com/51829935/206930213-3c101622-2f8f-4fcd-949d-46b971d9d552.png) -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'fabric-loom' version '1.7-SNAPSHOT' 3 | id 'maven-publish' 4 | } 5 | 6 | version = project.mod_version 7 | group = project.maven_group 8 | 9 | base { 10 | archivesName = project.archives_base_name 11 | } 12 | 13 | 14 | repositories { 15 | exclusiveContent { 16 | forRepository { 17 | maven { 18 | name = "Modrinth" 19 | url = "https://api.modrinth.com/maven" 20 | } 21 | } 22 | filter { 23 | includeGroup "maven.modrinth" 24 | } 25 | } 26 | maven { url "https://maven.shedaniel.me/" } 27 | maven { 28 | name = "Terraformers" 29 | url = "https://maven.terraformersmc.com/" 30 | } 31 | } 32 | 33 | dependencies { 34 | // To change the versions see the gradle.properties file 35 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 36 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 37 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 38 | 39 | // Fabric API. This is technically optional, but you probably want it anyway. 40 | modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 41 | 42 | modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}" 43 | modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { 44 | exclude(group: "net.fabricmc.fabric-api") 45 | } 46 | 47 | implementation project(':bili-live-danmu') 48 | 49 | 50 | include(project(":bili-live-danmu")) 51 | include 'com.fasterxml.jackson.core:jackson-databind:2.17.2' 52 | include 'com.fasterxml.jackson.core:jackson-core:2.17.2' 53 | include 'com.fasterxml.jackson.core:jackson-annotations:2.17.2' 54 | include "org.java-websocket:Java-WebSocket:1.5.7" 55 | } 56 | 57 | processResources { 58 | inputs.property "version", project.version 59 | inputs.property "minecraft_version", project.minecraft_version 60 | inputs.property "loader_version", project.loader_version 61 | filteringCharset "UTF-8" 62 | 63 | filesMatching("fabric.mod.json") { 64 | expand "version": project.version, 65 | "minecraft_version": project.minecraft_version, 66 | "loader_version": project.loader_version 67 | } 68 | } 69 | 70 | def targetJavaVersion = 17 71 | tasks.withType(JavaCompile).configureEach { 72 | // ensure that the encoding is set to UTF-8, no matter what the system default is 73 | // this fixes some edge cases with special characters not displaying correctly 74 | // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html 75 | // If Javadoc is generated, this must be specified in that task too. 76 | it.options.encoding = "UTF-8" 77 | if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { 78 | it.options.release.set(targetJavaVersion) 79 | } 80 | } 81 | 82 | java { 83 | def javaVersion = JavaVersion.toVersion(targetJavaVersion) 84 | if (JavaVersion.current() < javaVersion) { 85 | toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) 86 | } 87 | // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task 88 | // if it is present. 89 | // If you remove this line, sources will not be generated. 90 | withSourcesJar() 91 | } 92 | 93 | jar { 94 | from("LICENSE") { 95 | rename { "${it}_${project.archivesBaseName}" } 96 | } 97 | } 98 | 99 | // configure the maven publication 100 | publishing { 101 | publications { 102 | create("mavenJava", MavenPublication) { 103 | artifactId = project.archives_base_name 104 | from components.java 105 | } 106 | } 107 | 108 | // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. 109 | repositories { 110 | // Add repositories to publish to here. 111 | // Notice: This block does NOT have the same function as the block in the top level. 112 | // The repositories here will be used for publishing your artifact, not for 113 | // retrieving dependencies. 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://modmuss50.me/fabric.html 6 | minecraft_version=1.20.4 7 | yarn_mappings=1.20.4+build.3 8 | loader_version=0.15.11 9 | 10 | # Fabric API 11 | fabric_version=0.97.1+1.20.4 12 | 13 | # Mod Properties 14 | mod_version=2.0.1 15 | maven_group=cn.liqing 16 | archives_base_name=mousedanmu 17 | 18 | # Dependencies 19 | # check this on https://modmuss50.me/fabric.html 20 | modmenu_version=9.0.0 21 | cloth_config_version=13.0.121 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiQing-Code/mouse-danmu/0ef8e91dcb26f113ec4ab27a7920ce3b34d4db59/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | # This is normally unused 84 | # shellcheck disable=SC2034 85 | APP_BASE_NAME=${0##*/} 86 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 87 | APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 88 | 89 | # Use the maximum available, or set MAX_FD != -1 to use that value. 90 | MAX_FD=maximum 91 | 92 | warn () { 93 | echo "$*" 94 | } >&2 95 | 96 | die () { 97 | echo 98 | echo "$*" 99 | echo 100 | exit 1 101 | } >&2 102 | 103 | # OS specific support (must be 'true' or 'false'). 104 | cygwin=false 105 | msys=false 106 | darwin=false 107 | nonstop=false 108 | case "$( uname )" in #( 109 | CYGWIN* ) cygwin=true ;; #( 110 | Darwin* ) darwin=true ;; #( 111 | MSYS* | MINGW* ) msys=true ;; #( 112 | NONSTOP* ) nonstop=true ;; 113 | esac 114 | 115 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 116 | 117 | 118 | # Determine the Java command to use to start the JVM. 119 | if [ -n "$JAVA_HOME" ] ; then 120 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 121 | # IBM's JDK on AIX uses strange locations for the executables 122 | JAVACMD=$JAVA_HOME/jre/sh/java 123 | else 124 | JAVACMD=$JAVA_HOME/bin/java 125 | fi 126 | if [ ! -x "$JAVACMD" ] ; then 127 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 128 | 129 | Please set the JAVA_HOME variable in your environment to match the 130 | location of your Java installation." 131 | fi 132 | else 133 | JAVACMD=java 134 | if ! command -v java >/dev/null 2>&1 135 | then 136 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | fi 142 | 143 | # Increase the maximum file descriptors if we can. 144 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 145 | case $MAX_FD in #( 146 | max*) 147 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 148 | # shellcheck disable=SC2039,SC3045 149 | MAX_FD=$( ulimit -H -n ) || 150 | warn "Could not query maximum file descriptor limit" 151 | esac 152 | case $MAX_FD in #( 153 | '' | soft) :;; #( 154 | *) 155 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 156 | # shellcheck disable=SC2039,SC3045 157 | ulimit -n "$MAX_FD" || 158 | warn "Could not set maximum file descriptor limit to $MAX_FD" 159 | esac 160 | fi 161 | 162 | # Collect all arguments for the java command, stacking in reverse order: 163 | # * args from the command line 164 | # * the main class name 165 | # * -classpath 166 | # * -D...appname settings 167 | # * --module-path (only if needed) 168 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 169 | 170 | # For Cygwin or MSYS, switch paths to Windows format before running java 171 | if "$cygwin" || "$msys" ; then 172 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 173 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -classpath "$CLASSPATH" \ 214 | org.gradle.wrapper.GradleWrapperMain \ 215 | "$@" 216 | 217 | # Stop when "xargs" is not available. 218 | if ! command -v xargs >/dev/null 2>&1 219 | then 220 | die "xargs is not available" 221 | fi 222 | 223 | # Use "xargs" to parse quoted args. 224 | # 225 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 226 | # 227 | # In Bash we could simply go: 228 | # 229 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 230 | # set -- "${ARGS[@]}" "$@" 231 | # 232 | # but POSIX shell has neither arrays nor command substitution, so instead we 233 | # post-process each arg (as a line of input to sed) to backslash-escape any 234 | # character that might be a shell metacharacter, then use eval to reverse 235 | # that process (while maintaining the separation between arguments), and wrap 236 | # the whole thing up as a single "set" statement. 237 | # 238 | # This will of course break if any of these variables contains a newline or 239 | # an unmatched quote. 240 | # 241 | 242 | eval "set -- $( 243 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 244 | xargs -n1 | 245 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 246 | tr '\n' ' ' 247 | )" '"$@"' 248 | 249 | exec "$JAVACMD" "$@" 250 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%"=="" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%"=="" set DIRNAME=. 29 | @rem This is normally unused 30 | set APP_BASE_NAME=%~n0 31 | set APP_HOME=%DIRNAME% 32 | 33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 35 | 36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 38 | 39 | @rem Find java.exe 40 | if defined JAVA_HOME goto findJavaFromJavaHome 41 | 42 | set JAVA_EXE=java.exe 43 | %JAVA_EXE% -version >NUL 2>&1 44 | if %ERRORLEVEL% equ 0 goto execute 45 | 46 | echo. 1>&2 47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 48 | echo. 1>&2 49 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 50 | echo location of your Java installation. 1>&2 51 | 52 | goto fail 53 | 54 | :findJavaFromJavaHome 55 | set JAVA_HOME=%JAVA_HOME:"=% 56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 57 | 58 | if exist "%JAVA_EXE%" goto execute 59 | 60 | echo. 1>&2 61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 62 | echo. 1>&2 63 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 64 | echo location of your Java installation. 1>&2 65 | 66 | goto fail 67 | 68 | :execute 69 | @rem Setup the command line 70 | 71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 72 | 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if %ERRORLEVEL% equ 0 goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | set EXIT_CODE=%ERRORLEVEL% 85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 87 | exit /b %EXIT_CODE% 88 | 89 | :mainEnd 90 | if "%OS%"=="Windows_NT" endlocal 91 | 92 | :omega 93 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | maven { 4 | name = 'Fabric' 5 | url = 'https://maven.fabricmc.net/' 6 | } 7 | gradlePluginPortal() 8 | } 9 | } 10 | 11 | include ':bili-live-danmu' 12 | project(':bili-live-danmu').projectDir = new File(settingsDir, '../bili-live-danmu') 13 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/DanmuColorPicker.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import net.minecraft.entity.boss.BossBar; 4 | 5 | public class DanmuColorPicker { 6 | 7 | private final ModConfig config; 8 | 9 | public DanmuColorPicker(ModConfig config) { 10 | this.config = config; 11 | } 12 | 13 | public int user(int level) { 14 | return switch (level) { 15 | case 3 -> config.guard.level3; 16 | case 2 -> config.guard.level2; 17 | case 1 -> config.guard.level1; 18 | default -> config.guard.color; 19 | }; 20 | } 21 | 22 | public int fans(int level) { 23 | if (level > 28) { 24 | return config.danmu.fansLargerThan28; 25 | } else if (level > 24) { 26 | return config.danmu.fansLargerThan24; 27 | } else if (level > 20) { 28 | return config.danmu.fansLargerThan20; 29 | } else if (level > 16) { 30 | return config.danmu.fansLargerThan16; 31 | } else if (level > 12) { 32 | return config.danmu.fansLargerThan12; 33 | } else if (level > 8) { 34 | return config.danmu.fansLargerThan8; 35 | } else if (level > 4) { 36 | return config.danmu.fansLargerThan4; 37 | } else { 38 | return config.danmu.fansColor; 39 | } 40 | } 41 | 42 | public int gift(float price) { 43 | if (price >= config.gift.price4) { 44 | return config.gift.color4; 45 | } else if (price >= config.gift.price3) { 46 | return config.gift.color3; 47 | } else if (price >= config.gift.price2) { 48 | return config.gift.color2; 49 | } else if (price >= config.gift.price1) { 50 | return config.gift.color1; 51 | } else { 52 | return config.gift.color; 53 | } 54 | } 55 | 56 | public int superChat(float price) { 57 | if (price >= 2000) { 58 | return config.superChat.color2000; 59 | } else if (price >= 1000) { 60 | return config.superChat.color1000; 61 | } else if (price >= 500) { 62 | return config.superChat.color500; 63 | } else if (price >= 100) { 64 | return config.superChat.color100; 65 | } else if (price >= 50) { 66 | return config.superChat.color50; 67 | } else { 68 | return config.superChat.color; 69 | } 70 | } 71 | 72 | public static BossBar.Color superChatBossBar(float price) { 73 | if (price >= 2000) { 74 | return BossBar.Color.RED; 75 | } else if (price >= 1000) { 76 | return BossBar.Color.PINK; 77 | } else if (price >= 500) { 78 | return BossBar.Color.GREEN; 79 | } else if (price >= 100) { 80 | return BossBar.Color.YELLOW; 81 | } else if (price >= 50) { 82 | return BossBar.Color.BLUE; 83 | } else { 84 | return BossBar.Color.PURPLE; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/DanmuConverter.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import cn.liqing.bili.live.danmu.User; 4 | import cn.liqing.bili.live.danmu.model.*; 5 | import net.minecraft.text.*; 6 | import net.minecraft.util.Formatting; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public class DanmuConverter { 10 | final ModConfig config; 11 | final DanmuColorPicker colorPicker; 12 | 13 | public DanmuConverter(ModConfig config, DanmuColorPicker colorPicker) { 14 | this.config = config; 15 | this.colorPicker = colorPicker; 16 | } 17 | 18 | public MutableText convertUser(@NotNull User user) { 19 | var mutableText = Text.literal(user.name) 20 | .append(": ") 21 | .styled(style -> style 22 | .withColor(colorPicker.user(user.guardLevel)) 23 | .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, 24 | "https://space.bilibili.com/%s".formatted(user.uid))) 25 | .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, 26 | Text.translatable("text.mousedanmu.click-to-user-space")))); 27 | 28 | if (config.danmu.isShowFansMedal && user.fansMedal != null && !user.fansMedal.name.isEmpty()) { 29 | var fansMedalText = Texts.bracketed(Text.literal(user.fansMedal.name) 30 | .append("|") 31 | .append(String.valueOf(user.fansMedal.level))) 32 | .styled(style -> style.withColor(colorPicker.fans(user.fansMedal.level))); 33 | mutableText = fansMedalText.append(mutableText); 34 | } 35 | return mutableText; 36 | } 37 | 38 | public MutableText convert(@NotNull Danmu danmu) { 39 | MutableText text = Text.literal(danmu.body).formatted(Formatting.WHITE); 40 | if (danmu.user.guardLevel > 0) { 41 | text = Texts.bracketed(text).styled(style -> 42 | style.withColor(colorPicker.user(danmu.user.guardLevel))); 43 | } 44 | return convertUser(danmu.user).append(text); 45 | 46 | } 47 | 48 | public MutableText convert(@NotNull Gift gift) { 49 | var mutableText = Texts.bracketed(Text.literal(gift.name)) 50 | .styled(style -> style.withColor(colorPicker.gift(gift.price))) 51 | .append(" × ").append(String.valueOf(gift.num)); 52 | if (gift.price > 0) { 53 | mutableText = mutableText.append(" ¥").append(String.valueOf(gift.price)); 54 | } 55 | return convertUser(gift.user).append(mutableText); 56 | } 57 | 58 | public MutableText convert(@NotNull Emoji emoji) { 59 | var mutableText = Texts.bracketed(Text.literal(emoji.body)) 60 | .styled(style -> style.withColor(config.danmu.emojiColor) 61 | .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, emoji.uri)) 62 | .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, 63 | Text.translatable("text.mousedanmu.click-to-view-emoji")))); 64 | return convertUser(emoji.user).append(mutableText); 65 | } 66 | 67 | public MutableText convert(@NotNull SuperChat sc) { 68 | var mutableText = Texts.bracketed(Text.literal(String.valueOf(sc.price))) 69 | .append(Text.literal(sc.body)) 70 | .styled(style -> style 71 | .withColor(colorPicker.superChat(sc.price)) 72 | .withBold(true)); 73 | return convertUser(sc.user).append(mutableText); 74 | } 75 | 76 | public MutableText convert(@NotNull Guard guard) { 77 | var mutableText = Texts.bracketed(Text.literal(guard.name)) 78 | .styled(style -> style.withColor(colorPicker.user(guard.level))) 79 | .append(" × ").append(String.valueOf(guard.num)).append(guard.unit); 80 | if (guard.price > 0) { 81 | mutableText = mutableText.append(" ¥").append(String.valueOf(guard.price)); 82 | } 83 | return convertUser(guard.user).append(mutableText); 84 | } 85 | 86 | public MutableText convert(@NotNull Interactive interactive) { 87 | var msg = switch (interactive.type) { 88 | case 1 -> Text.translatable("text.mousedanmu.entry-live-room"); 89 | case 2 -> Text.translatable("text.mousedanmu.attention-live-room"); 90 | case 3 -> Text.translatable("text.mousedanmu.share-live-room"); 91 | case 4 -> Text.translatable("text.mousedanmu.special-attention-live-room"); 92 | case 5 -> Text.translatable("text.mousedanmu.mutual-attention-live-room"); 93 | default -> Text.literal("未知互动类型:%d".formatted(interactive.type)); 94 | }; 95 | var mutableText = Texts.bracketed(msg) 96 | .styled(style -> style.withColor(config.danmu.interactiveColor)); 97 | return convertUser(interactive.user).append(mutableText); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/ModConfig.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import me.shedaniel.autoconfig.ConfigData; 4 | import me.shedaniel.autoconfig.annotation.Config; 5 | import me.shedaniel.autoconfig.annotation.ConfigEntry; 6 | import me.shedaniel.math.Color; 7 | 8 | import java.util.ArrayList; 9 | 10 | @Config(name = MouseDanmu.MOD_ID) 11 | public class ModConfig implements ConfigData { 12 | @ConfigEntry.Category("liveRoom") 13 | @ConfigEntry.Gui.TransitiveObject 14 | public LiveRoomConfig liveRoom = new LiveRoomConfig(); 15 | 16 | @Config(name = "liveRoom") 17 | public static class LiveRoomConfig implements ConfigData { 18 | @ConfigEntry.Gui.Tooltip 19 | public boolean autoConnect = false; 20 | @ConfigEntry.Gui.Tooltip 21 | public int roomId = 24256088; 22 | @ConfigEntry.Gui.Tooltip 23 | public String cookie = ""; 24 | 25 | public ArrayList history = new ArrayList<>(); 26 | } 27 | 28 | @ConfigEntry.Category("danmu") 29 | @ConfigEntry.Gui.TransitiveObject 30 | public DanmuConfig danmu = new DanmuConfig(); 31 | 32 | @Config(name = "danmu") 33 | public static class DanmuConfig implements ConfigData { 34 | public boolean isShow = true; 35 | public boolean isShowEmoji = true; 36 | @ConfigEntry.ColorPicker 37 | public int emojiColor = Color.ofRGBA(240, 248, 187, 0).getColor(); 38 | public boolean isShowInteractive = true; 39 | public boolean isShowInteractiveToOverlayMessage = false; 40 | @ConfigEntry.ColorPicker 41 | public int interactiveColor = Color.ofRGBA(177, 241, 184, 0).getColor(); 42 | public boolean isShowFansMedal = true; 43 | @ConfigEntry.ColorPicker 44 | public int fansColor = Color.ofRGBA(92, 150, 142, 0).getColor(); 45 | @ConfigEntry.ColorPicker 46 | public int fansLargerThan4 = Color.ofRGBA(93, 123, 158, 0).getColor(); 47 | @ConfigEntry.ColorPicker 48 | public int fansLargerThan8 = Color.ofRGBA(141, 124, 166, 0).getColor(); 49 | @ConfigEntry.ColorPicker 50 | public int fansLargerThan12 = Color.ofRGBA(190, 102, 134, 0).getColor(); 51 | @ConfigEntry.ColorPicker 52 | public int fansLargerThan16 = Color.ofRGBA(199, 157, 36, 0).getColor(); 53 | @ConfigEntry.ColorPicker 54 | public int fansLargerThan20 = Color.ofRGBA(26, 84, 75, 0).getColor(); 55 | @ConfigEntry.ColorPicker 56 | //public int fansLargerThan24 = Color.ofRGBA(6, 21, 76, 0).getColor(); 57 | public int fansLargerThan24 = Color.ofRGBA(102, 179, 255, 0).getColor(); 58 | @ConfigEntry.ColorPicker 59 | //public int fansLargerThan28 = Color.ofRGBA(45, 8, 85, 0).getColor(); 60 | public int fansLargerThan28 = Color.ofRGBA(255, 128, 223, 0).getColor(); 61 | } 62 | 63 | 64 | @ConfigEntry.Category("gift") 65 | @ConfigEntry.Gui.TransitiveObject 66 | public GiftConfig gift = new GiftConfig(); 67 | 68 | @Config(name = "gift") 69 | public static class GiftConfig implements ConfigData { 70 | public boolean isShow = true; 71 | public boolean isShowFreeGiftToOverlayMessage = false; 72 | 73 | @ConfigEntry.ColorPicker 74 | public int color = Color.ofRGBA(255, 215, 119, 0).getColor(); 75 | 76 | public int price1 = 5; 77 | @ConfigEntry.ColorPicker 78 | public int color1 = Color.ofRGBA(173, 255, 47, 0).getColor(); 79 | 80 | public int price2 = 10; 81 | @ConfigEntry.ColorPicker 82 | public int color2 = Color.ofRGBA(255, 255, 0, 0).getColor(); 83 | 84 | public int price3 = 50; 85 | @ConfigEntry.ColorPicker 86 | public int color3 = Color.ofRGBA(51, 153, 255, 0).getColor(); 87 | 88 | public int price4 = 100; 89 | @ConfigEntry.ColorPicker 90 | public int color4 = Color.ofRGBA(255, 0, 255, 0).getColor(); 91 | } 92 | 93 | 94 | @ConfigEntry.Category("superChat") 95 | @ConfigEntry.Gui.TransitiveObject 96 | public SuperChatConfig superChat = new SuperChatConfig(); 97 | 98 | @Config(name = "superChat") 99 | public static class SuperChatConfig implements ConfigData { 100 | public boolean isShowChat = true; 101 | public boolean isShowBossBar = true; 102 | 103 | @ConfigEntry.ColorPicker 104 | public int color = Color.ofRGBA(42, 96, 178, 0).getColor(); 105 | @ConfigEntry.ColorPicker 106 | public int color50 = Color.ofRGBA(66, 125, 158, 0).getColor(); 107 | @ConfigEntry.ColorPicker 108 | public int color100 = Color.ofRGBA(226, 181, 43, 0).getColor(); 109 | @ConfigEntry.ColorPicker 110 | public int color500 = Color.ofRGBA(224, 148, 67, 0).getColor(); 111 | @ConfigEntry.ColorPicker 112 | public int color1000 = Color.ofRGBA(229, 77, 77, 0).getColor(); 113 | @ConfigEntry.ColorPicker 114 | public int color2000 = Color.ofRGBA(171, 26, 50, 0).getColor(); 115 | } 116 | 117 | @ConfigEntry.Category("guard") 118 | @ConfigEntry.Gui.TransitiveObject 119 | public GuardConfig guard = new GuardConfig(); 120 | 121 | @Config(name = "guard") 122 | public static class GuardConfig implements ConfigData { 123 | public boolean isShow = true; 124 | @ConfigEntry.ColorPicker 125 | public int color = Color.ofRGBA(255, 255, 255, 0).getColor(); 126 | 127 | @ConfigEntry.ColorPicker 128 | public int level1 = Color.ofRGBA(250, 103, 67, 0).getColor(); 129 | 130 | @ConfigEntry.ColorPicker 131 | public int level2 = Color.ofRGBA(171, 64, 250, 0).getColor(); 132 | 133 | @ConfigEntry.ColorPicker 134 | public int level3 = Color.ofRGBA(81, 104, 250, 0).getColor(); 135 | } 136 | } -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/ModMenuIntegration.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import com.terraformersmc.modmenu.api.ConfigScreenFactory; 4 | import com.terraformersmc.modmenu.api.ModMenuApi; 5 | import me.shedaniel.autoconfig.AutoConfig; 6 | 7 | public class ModMenuIntegration implements ModMenuApi { 8 | @Override 9 | public ConfigScreenFactory getModConfigScreenFactory() { 10 | return parent -> AutoConfig.getConfigScreen(ModConfig.class, parent).get(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/MouseDanmu.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import cn.liqing.mousedanmu.command.MouseDanmuCommand; 4 | import me.shedaniel.autoconfig.AutoConfig; 5 | import me.shedaniel.autoconfig.ConfigHolder; 6 | import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; 7 | import net.fabricmc.api.ClientModInitializer; 8 | import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; 9 | 10 | public class MouseDanmu implements ClientModInitializer { 11 | public static final String MOD_ID = "mousedanmu"; 12 | private static ConfigHolder configHolder; 13 | public static MouseDanmuClient client; 14 | 15 | @Override 16 | public void onInitializeClient() { 17 | AutoConfig.register(ModConfig.class, JanksonConfigSerializer::new); 18 | configHolder = AutoConfig.getConfigHolder(ModConfig.class); 19 | client = new MouseDanmuClient(configHolder.getConfig()); 20 | ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) -> 21 | MouseDanmuCommand.register(dispatcher)); 22 | } 23 | 24 | public static ModConfig getConfig() { 25 | return configHolder.getConfig(); 26 | } 27 | 28 | public static void save(){ 29 | configHolder.save(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/MouseDanmuClient.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import cn.liqing.bili.live.danmu.Auth; 4 | import cn.liqing.bili.live.danmu.ConnectionListener; 5 | import cn.liqing.bili.live.danmu.DanmuClient; 6 | import cn.liqing.bili.live.danmu.User; 7 | import cn.liqing.bili.live.danmu.handler.*; 8 | import cn.liqing.bili.live.danmu.model.*; 9 | import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents; 10 | import net.fabricmc.fabric.api.networking.v1.PacketSender; 11 | import net.minecraft.client.MinecraftClient; 12 | import net.minecraft.client.network.ClientPlayNetworkHandler; 13 | import net.minecraft.entity.player.PlayerEntity; 14 | import net.minecraft.text.ClickEvent; 15 | import net.minecraft.text.HoverEvent; 16 | import net.minecraft.text.MutableText; 17 | import net.minecraft.text.Text; 18 | import net.minecraft.util.Formatting; 19 | import org.jetbrains.annotations.NotNull; 20 | import org.jetbrains.annotations.Nullable; 21 | import org.slf4j.Logger; 22 | import org.slf4j.LoggerFactory; 23 | 24 | public class MouseDanmuClient implements ClientPlayConnectionEvents.Disconnect, ClientPlayConnectionEvents.Join, ConnectionListener { 25 | static final Logger LOGGER = LoggerFactory.getLogger(MouseDanmuClient.class); 26 | 27 | @Nullable 28 | PlayerEntity player; 29 | final ModConfig config; 30 | final DanmuConverter danmuText; 31 | final DanmuColorPicker colorPicker; 32 | final SuperChatManager superChatManager; 33 | final DanmuClient client; 34 | private int room; 35 | 36 | public MouseDanmuClient(ModConfig config) { 37 | ClientPlayConnectionEvents.JOIN.register(this); 38 | ClientPlayConnectionEvents.DISCONNECT.register(this); 39 | this.config = config; 40 | colorPicker = new DanmuColorPicker(config); 41 | danmuText = new DanmuConverter(config, colorPicker); 42 | superChatManager = new SuperChatManager(danmuText, colorPicker); 43 | client = new DanmuClient(); 44 | client.setListener(this); 45 | 46 | client.addHandler(new DanmuHandler(this::onDanmu)); 47 | client.addHandler(new EomjiHandler(this::onEmoji)); 48 | client.addHandler(new GiftHandler(this::onGift)); 49 | client.addHandler(new GuardHandler(this::onGuard)); 50 | client.addHandler(new InteractiveHandler(this::onInteractive)); 51 | client.addHandler(new SuperChatHandler(this::onSuperChat)); 52 | } 53 | 54 | @Override 55 | public void onPlayDisconnect(ClientPlayNetworkHandler handler, MinecraftClient client) { 56 | close(); 57 | player = null; 58 | } 59 | 60 | @Override 61 | public void onPlayReady(ClientPlayNetworkHandler handler, PacketSender sender, @NotNull MinecraftClient client) { 62 | player = client.player; 63 | if (config.liveRoom.autoConnect && config.liveRoom.roomId != 0) { 64 | connect(config.liveRoom.roomId); 65 | } 66 | } 67 | 68 | public void connect(int room) { 69 | this.room = room; 70 | try { 71 | Auth auth = config.liveRoom.cookie.isEmpty() ? 72 | Auth.create(room) : 73 | Auth.create(room, config.liveRoom.cookie); 74 | client.connect(auth); 75 | } catch (Exception e) { 76 | LOGGER.error("鼠鼠出错", e); 77 | String msg = "鼠鼠出错:" + e.getMessage(); 78 | if (player != null) 79 | player.sendMessage(Text.literal(msg).formatted(Formatting.RED)); 80 | } 81 | 82 | //添加连接记录 83 | var history = config.liveRoom.history; 84 | int i = history.indexOf(room); 85 | if (i != -1) 86 | history.remove(i); 87 | history.add(0, room); 88 | } 89 | 90 | public void close() { 91 | client.disconnect(); 92 | superChatManager.clear(); 93 | } 94 | 95 | public void status() { 96 | if (player == null) 97 | return; 98 | MutableText text; 99 | if (client.isOpen()) { 100 | text = Text.translatable("text.mousedanmu.live-room-connected", String.valueOf(room)) 101 | .formatted(Formatting.GREEN) 102 | .styled(style -> style 103 | .withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, 104 | "https://live.bilibili.com/" + room)) 105 | .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, 106 | Text.translatable("text.mousedanmu.open-live-room")))); 107 | } else { 108 | text = Text.translatable("text.mousedanmu.live-room-closed"); 109 | } 110 | player.sendMessage(text); 111 | } 112 | 113 | public void test(int delay) throws InterruptedException { 114 | //普通消息 115 | var user = new User(); 116 | user.name = "立青"; 117 | user.uid = "345259002"; 118 | user.guardLevel = 0; 119 | var danmu = new Danmu(); 120 | danmu.user = user; 121 | danmu.body = "初见,可以点我名字打开主页"; 122 | onDanmu(danmu); 123 | Thread.sleep(delay); 124 | 125 | //表情 126 | var emoji = new Emoji(); 127 | emoji.uri = "https://www.bilibili.com/video/BV1GJ411x7h7"; 128 | emoji.body = "这是表情,我不会显示图片,可以点击查看图片!"; 129 | emoji.user = user; 130 | onEmoji(emoji); 131 | Thread.sleep(delay); 132 | 133 | //打赏和粉丝团1级 134 | user.fansMedal = new User.FansMedal(); 135 | user.fansMedal.name = "粉丝团"; 136 | user.fansMedal.level = 1; 137 | var gift = new Gift(); 138 | gift.price = 1; 139 | gift.name = "粉丝团灯牌"; 140 | gift.num = 1; 141 | gift.user = user; 142 | onGift(gift); 143 | Thread.sleep(delay); 144 | 145 | gift.price = config.gift.price1; 146 | gift.name = "礼物1"; 147 | onGift(gift); 148 | Thread.sleep(delay); 149 | gift.price = config.gift.price2; 150 | gift.name = "礼物2"; 151 | onGift(gift); 152 | Thread.sleep(delay); 153 | gift.price = config.gift.price3; 154 | gift.name = "礼物3"; 155 | onGift(gift); 156 | Thread.sleep(delay); 157 | gift.price = config.gift.price4; 158 | gift.name = "礼物4"; 159 | onGift(gift); 160 | Thread.sleep(delay); 161 | 162 | //粉丝团5级 163 | user.fansMedal.name = "粉丝团"; 164 | user.fansMedal.level = 5; 165 | danmu.body = "牌牌真好看"; 166 | onDanmu(danmu); 167 | Thread.sleep(delay); 168 | 169 | //粉丝团9级 170 | user.fansMedal.name = "粉丝团"; 171 | user.fansMedal.level = 9; 172 | danmu.body = "9级了耶"; 173 | onDanmu(danmu); 174 | Thread.sleep(delay); 175 | 176 | //粉丝团13级 177 | user.fansMedal.name = "粉丝团"; 178 | user.fansMedal.level = 13; 179 | danmu.body = "别问我的等级怎么涨的"; 180 | onDanmu(danmu); 181 | Thread.sleep(delay); 182 | 183 | //粉丝团17级 184 | user.fansMedal.name = "ikun"; 185 | user.fansMedal.level = 17; 186 | danmu.body = "我xxx没有开挂,你干嘛~哎哟"; 187 | onDanmu(danmu); 188 | user.fansMedal.name = "粉丝团"; 189 | Thread.sleep(delay); 190 | 191 | //粉丝团21级及舰长 192 | var guard = new Guard(); 193 | guard.user = user; 194 | guard.name = "舰长"; 195 | guard.unit = "月"; 196 | guard.level = 3; 197 | user.guardLevel = 3; 198 | guard.num = 1; 199 | guard.price = 138; 200 | onGuard(guard); 201 | Thread.sleep(delay); 202 | user.fansMedal.name = "粉丝团"; 203 | user.fansMedal.level = 21; 204 | danmu.body = "舰长有什么礼物吗?"; 205 | onDanmu(danmu); 206 | Thread.sleep(delay); 207 | 208 | //粉丝团25级及提督 209 | guard.name = "提督"; 210 | guard.level = 2; 211 | user.guardLevel = 2; 212 | guard.price = 1998; 213 | onGuard(guard); 214 | Thread.sleep(delay); 215 | user.fansMedal.name = "粉丝团"; 216 | user.fansMedal.level = 25; 217 | danmu.body = "提督总有礼物吧!!!"; 218 | onDanmu(danmu); 219 | Thread.sleep(delay); 220 | 221 | //粉丝团29级及总督 222 | guard.name = "总督"; 223 | guard.level = 1; 224 | user.guardLevel = 1; 225 | guard.price = 19998; 226 | onGuard(guard); 227 | Thread.sleep(delay); 228 | user.fansMedal.name = "蒙古人"; 229 | user.fansMedal.level = 29; 230 | danmu.body = "别激动,这其实是代码生成的总督,希望大家别被骗了"; 231 | onDanmu(danmu); 232 | user.fansMedal.name = "粉丝团"; 233 | Thread.sleep(delay); 234 | 235 | var sc = new SuperChat(); 236 | sc.user = user; 237 | 238 | sc.time = 30; 239 | sc.price = 1000; 240 | sc.body = "我柜子动了,我不玩了"; 241 | onSuperChat(sc); 242 | Thread.sleep(delay); 243 | 244 | sc.time = 20; 245 | sc.price = 30; 246 | sc.body = "SC才能点歌吗"; 247 | onSuperChat(sc); 248 | Thread.sleep(delay); 249 | 250 | sc.price = 50; 251 | sc.body = "这不对吧,SC时间怎么走这么快"; 252 | onSuperChat(sc); 253 | Thread.sleep(delay); 254 | 255 | sc.price = 100; 256 | sc.body = "鼠鼠你坏事做尽"; 257 | onSuperChat(sc); 258 | Thread.sleep(delay); 259 | 260 | sc.price = 500; 261 | sc.body = "把你变成狗"; 262 | onSuperChat(sc); 263 | Thread.sleep(delay); 264 | 265 | sc.time = 30; 266 | user.fansMedal.name = "雏草姬"; 267 | sc.price = 2000; 268 | sc.body = "关注永雏塔菲喵!关注永雏塔菲谢谢喵!"; 269 | onSuperChat(sc); 270 | } 271 | 272 | public void onDanmu(Danmu danmu) { 273 | if (config.danmu.isShow && player != null) 274 | player.sendMessage(danmuText.convert(danmu)); 275 | } 276 | 277 | public void onEmoji(Emoji emoji) { 278 | if (config.danmu.isShowEmoji && player != null) 279 | player.sendMessage(danmuText.convert(emoji)); 280 | } 281 | 282 | public void onGift(Gift gift) { 283 | if (config.gift.isShow && player != null) { 284 | if (config.gift.isShowFreeGiftToOverlayMessage && gift.price <= 0) { 285 | MinecraftClient.getInstance().inGameHud 286 | .setOverlayMessage(danmuText.convert(gift), false); 287 | } else { 288 | player.sendMessage(danmuText.convert(gift)); 289 | } 290 | } 291 | } 292 | 293 | public void onSuperChat(SuperChat sc) { 294 | if (config.superChat.isShowBossBar) { 295 | superChatManager.add(sc); 296 | } 297 | if (config.superChat.isShowChat && player != null) { 298 | player.sendMessage(danmuText.convert(sc)); 299 | } 300 | } 301 | 302 | public void onGuard(Guard guard) { 303 | if (config.guard.isShow && player != null) 304 | player.sendMessage(danmuText.convert(guard)); 305 | } 306 | 307 | public void onInteractive(Interactive interactive) { 308 | if (config.danmu.isShowInteractive && player != null) { 309 | player.sendMessage(danmuText.convert(interactive)); 310 | } 311 | if (config.danmu.isShowInteractiveToOverlayMessage) 312 | MinecraftClient.getInstance().inGameHud.setOverlayMessage( 313 | danmuText.convert(interactive), false); 314 | } 315 | 316 | @Override 317 | public void onClose(int code, String reason, boolean remote) { 318 | String msg; 319 | msg = "已断开连接,代码:%d".formatted(code); 320 | LOGGER.info(msg); 321 | if (player != null) 322 | player.sendMessage(Text.literal(msg).formatted(Formatting.GOLD)); 323 | } 324 | 325 | @Override 326 | public void onError(Exception ex) { 327 | LOGGER.error("鼠鼠出错", ex); 328 | String msg = "鼠鼠出错:" + ex.getMessage(); 329 | if (player != null) 330 | player.sendMessage(Text.literal(msg).formatted(Formatting.RED)); 331 | } 332 | 333 | @Override 334 | public void onOpen() { 335 | LOGGER.info("已连接:%d".formatted(room)); 336 | status(); 337 | } 338 | 339 | public void sendDanmu(String message) { 340 | try { 341 | DanmuClient.send(config.liveRoom.cookie, String.valueOf(room), message); 342 | } catch (Exception e) { 343 | LOGGER.error("鼠鼠出错", e); 344 | String msg = "鼠鼠出错:" + e.getMessage(); 345 | if (player != null) 346 | player.sendMessage(Text.literal(msg).formatted(Formatting.RED)); 347 | } 348 | } 349 | } 350 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/SuperChatManager.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu; 2 | 3 | import cn.liqing.bili.live.danmu.model.SuperChat; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.gui.hud.BossBarHud; 6 | import net.minecraft.entity.boss.BossBar; 7 | import net.minecraft.network.packet.s2c.play.BossBarS2CPacket; 8 | import net.minecraft.text.MutableText; 9 | import net.minecraft.text.Text; 10 | import net.minecraft.text.Texts; 11 | import net.minecraft.util.Formatting; 12 | import org.jetbrains.annotations.Nullable; 13 | 14 | import java.util.ArrayList; 15 | import java.util.Timer; 16 | import java.util.TimerTask; 17 | import java.util.UUID; 18 | 19 | public class SuperChatManager { 20 | final MinecraftClient client; 21 | private final DanmuConverter danmuText; 22 | private final DanmuColorPicker colorPicker; 23 | final ArrayList superChatList = new ArrayList<>(); 24 | final ArrayList displayList = new ArrayList<>(4); 25 | @Nullable Timer handlePacketTimer; 26 | 27 | public SuperChatManager(DanmuConverter danmuText, DanmuColorPicker colorPicker) { 28 | this.client = MinecraftClient.getInstance(); 29 | this.danmuText = danmuText; 30 | this.colorPicker = colorPicker; 31 | } 32 | 33 | public void add(SuperChat sc) { 34 | UUID uuid = UUID.randomUUID(); 35 | //准备显示文本 36 | var fans = sc.user.fansMedal; 37 | sc.user.fansMedal = null; 38 | MutableText text = danmuText.convertUser(sc.user) 39 | .append(Texts.bracketed(Text.literal(String.valueOf(sc.price))) 40 | .styled(style -> style.withColor(colorPicker.superChat(sc.price)))) 41 | .append(Text.literal(sc.body).formatted(Formatting.WHITE)); 42 | sc.user.fansMedal = fans; 43 | 44 | ScBossBar scBossBar = new ScBossBar(uuid, text, 45 | DanmuColorPicker.superChatBossBar(sc.price), 46 | BossBar.Style.PROGRESS, sc.time); 47 | 48 | synchronized (superChatList) { 49 | superChatList.add(scBossBar); 50 | } 51 | 52 | if (handlePacketTimer == null) { 53 | handlePacketTimer = new Timer(); 54 | handlePacketTimer.schedule(handlePackets(), 0, 1000); 55 | } 56 | } 57 | 58 | public void clear() { 59 | if (handlePacketTimer != null) { 60 | handlePacketTimer.cancel(); 61 | handlePacketTimer = null; 62 | } 63 | synchronized (superChatList) { 64 | superChatList.clear(); 65 | } 66 | client.submit(() -> client.inGameHud.getBossBarHud().clear()); 67 | displayList.clear(); 68 | } 69 | 70 | 71 | TimerTask handlePackets() { 72 | BossBarHud hud = client.inGameHud.getBossBarHud(); 73 | return new TimerTask() { 74 | static final int showTime = 15; 75 | @Override 76 | public void run() { 77 | //更新以及删除醒目留言 78 | for (int i = displayList.size() - 1; i >= 0; i--) { 79 | var sc = displayList.get(i); 80 | BossBarS2CPacket packet; 81 | if (sc.getPercent() <= 0) { 82 | displayList.remove(sc); 83 | packet = BossBarS2CPacket.remove(sc.getUuid()); 84 | } else { 85 | packet = BossBarS2CPacket.updateProgress(sc); 86 | } 87 | client.submit(() -> hud.handlePacket(packet)); 88 | sc.updateDisplay(); 89 | } 90 | //添加醒目留言到显示列表 91 | synchronized (superChatList) { 92 | for (int i = superChatList.size() - 1; i >= 0; i--) { 93 | var sc = superChatList.get(i); 94 | sc.updateTime(); 95 | if (sc.getPercent() <= 0) 96 | superChatList.remove(i); 97 | } 98 | if (superChatList.isEmpty()) 99 | return; 100 | //溢出时暂时移除已经显示showTime秒或以上的 101 | if (displayList.size() >= 4 && 102 | superChatList.stream().anyMatch(sc -> sc.displayTime < showTime)) { 103 | @Nullable ScBossBar sc = displayList.stream() 104 | .filter(s -> s.displayTime >= showTime) 105 | .findFirst().orElse(null); 106 | if (sc != null) { 107 | superChatList.add(sc); 108 | displayList.remove(sc); 109 | client.submit(() -> hud.handlePacket(BossBarS2CPacket.remove(sc.getUuid()))); 110 | } else 111 | return; 112 | } 113 | ScBossBar sc = superChatList.stream() 114 | .filter(s -> s.displayTime < showTime) 115 | .findFirst().orElse(superChatList.get(0)); 116 | displayList.add(sc); 117 | client.submit(() -> hud.handlePacket(BossBarS2CPacket.add(sc))); 118 | superChatList.remove(sc); 119 | } 120 | } 121 | }; 122 | } 123 | 124 | static class ScBossBar extends BossBar { 125 | public float time; 126 | public int displayTime; 127 | 128 | public void updateTime() { 129 | percent -= time; 130 | } 131 | 132 | public void updateDisplay() { 133 | displayTime++; 134 | updateTime(); 135 | } 136 | 137 | public ScBossBar(UUID uuid, Text name, Color color, Style style, int time) { 138 | super(uuid, name, color, style); 139 | this.time = percent / time; 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/command/MouseDanmuCommand.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu.command; 2 | 3 | import cn.liqing.mousedanmu.MouseDanmu; 4 | import cn.liqing.mousedanmu.command.argument.RoomIdArgumentType; 5 | import com.mojang.brigadier.CommandDispatcher; 6 | import com.mojang.brigadier.arguments.IntegerArgumentType; 7 | import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; 8 | import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; 9 | import net.minecraft.command.argument.MessageArgumentType; 10 | 11 | public class MouseDanmuCommand { 12 | public static void register(CommandDispatcher dispatcher) { 13 | var literalCommandNode = dispatcher.register(ClientCommandManager.literal("mousedanmu") 14 | .then(ClientCommandManager.literal("connect") 15 | .then(ClientCommandManager.argument("roomId", RoomIdArgumentType.roomId()) 16 | .executes(context -> connect(context.getArgument("roomId", Integer.class))))) 17 | .then(ClientCommandManager.literal("close") 18 | .executes(context -> close())) 19 | .then(ClientCommandManager.literal("status") 20 | .executes(context -> status())) 21 | .then(ClientCommandManager.literal("test") 22 | .then(ClientCommandManager.argument("delay", IntegerArgumentType.integer(0, 10000)) 23 | .executes(context -> test(context.getArgument("delay", Integer.class)))) 24 | .executes(context -> test(500))) 25 | .then(ClientCommandManager.argument("message", MessageArgumentType.message()) 26 | .executes(context -> send(context.getArgument("message", MessageArgumentType.MessageFormat.class).getContents())))); 27 | 28 | dispatcher.register(ClientCommandManager.literal("dm").redirect(literalCommandNode)); 29 | } 30 | 31 | public static int connect(int roomId) { 32 | MouseDanmu.client.close(); 33 | MouseDanmu.client.connect(roomId); 34 | MouseDanmu.save(); 35 | return 1; 36 | } 37 | 38 | public static int close() { 39 | MouseDanmu.client.close(); 40 | return 1; 41 | } 42 | 43 | public static int status() { 44 | MouseDanmu.client.status(); 45 | return 1; 46 | } 47 | 48 | public static int test(int delay) { 49 | new Thread(() -> { 50 | try { 51 | MouseDanmu.client.test(delay); 52 | } catch (InterruptedException ignored) { 53 | } 54 | }).start(); 55 | return 1; 56 | } 57 | 58 | public static int send(String message) { 59 | new Thread(() -> MouseDanmu.client.sendDanmu(message)).start(); 60 | return 1; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/cn/liqing/mousedanmu/command/argument/RoomIdArgumentType.java: -------------------------------------------------------------------------------- 1 | package cn.liqing.mousedanmu.command.argument; 2 | 3 | import cn.liqing.mousedanmu.MouseDanmu; 4 | import com.mojang.brigadier.StringReader; 5 | import com.mojang.brigadier.arguments.ArgumentType; 6 | import com.mojang.brigadier.context.CommandContext; 7 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 8 | import com.mojang.brigadier.suggestion.Suggestions; 9 | import com.mojang.brigadier.suggestion.SuggestionsBuilder; 10 | 11 | import java.util.concurrent.CompletableFuture; 12 | 13 | public class RoomIdArgumentType implements ArgumentType { 14 | public static RoomIdArgumentType roomId() { 15 | return new RoomIdArgumentType(); 16 | } 17 | 18 | @Override 19 | public Integer parse(StringReader reader) throws CommandSyntaxException { 20 | return reader.readInt(); 21 | } 22 | 23 | @Override 24 | public CompletableFuture listSuggestions(CommandContext context, SuggestionsBuilder builder) { 25 | MouseDanmu.getConfig().liveRoom.history.forEach(builder::suggest); 26 | return builder.buildFuture(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/assets/mousedanmu/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiQing-Code/mouse-danmu/0ef8e91dcb26f113ec4ab27a7920ce3b34d4db59/src/main/resources/assets/mousedanmu/icon.png -------------------------------------------------------------------------------- /src/main/resources/assets/mousedanmu/lang/en_us.json: -------------------------------------------------------------------------------- 1 | { 2 | "modmenu.nameTranslation.mousedanmu": "MouseDanmu", 3 | "modmenu.descriptionTranslation.mousedanmu": "Watch Bilibili live comments in Minecraft!\n Use '/mousedanmu' or '/dm' to control\n '/dm connect room_id' to connect to a live room\nClick the website button for more usage help\n\nDisclaimer:\nThis mod is used to retrieve Bilibili live comments and display them in the Minecraft chat box, providing functionality to use user cookies to retrieve and send comments.\n\nPlease note:\n1. Using user cookies to retrieve or send comments may result in the Bilibili account being banned, although there are no clear cases yet.\n2. If you stream Minecraft while using this mod, comments displayed in the game chat box are from Bilibili, and non-compliant comments may cause your live room to be banned.\n\nBy using this mod, you understand and accept the above risks. The developer is not responsible for any account or live room bans resulting from the use of this mod.", 4 | "mousedanmu.bilibili": "Bilibili", 5 | "mousedanmu.qun": "QQ Group", 6 | "text.autoconfig.mousedanmu.category.danmu": "Danmu", 7 | "text.autoconfig.mousedanmu.category.gift": "Gift", 8 | "text.autoconfig.mousedanmu.category.guard": "Guard", 9 | "text.autoconfig.mousedanmu.category.liveRoom": "Live Room", 10 | "text.autoconfig.mousedanmu.category.superChat": "Super Chat", 11 | "text.autoconfig.mousedanmu.option.danmu.emojiColor": "Emoticon Color", 12 | "text.autoconfig.mousedanmu.option.danmu.fansColor": "Fans Medal 1-4 Level", 13 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan12": "Fans Medal >12 Level", 14 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan16": "Fans Medal >16 Level", 15 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan20": "Fans Medal >20 Level", 16 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan24": "Fans Medal >24 Level", 17 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan28": "Fans Medal >28 Level", 18 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan4": "Fans Medal >4 Level", 19 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan8": "Fans Medal >8 Level", 20 | "text.autoconfig.mousedanmu.option.danmu.interactiveColor": "Interactive Message Color", 21 | "text.autoconfig.mousedanmu.option.danmu.isShow": "Show Danmu", 22 | "text.autoconfig.mousedanmu.option.danmu.isShowEmoji": "Show Emoticons", 23 | "text.autoconfig.mousedanmu.option.danmu.isShowFansMedal": "Show Fans Medal", 24 | "text.autoconfig.mousedanmu.option.danmu.isShowInteractive": "Show Interactive Message in Chat", 25 | "text.autoconfig.mousedanmu.option.danmu.isShowInteractiveToOverlayMessage": "Show Interactive Message in Overlay", 26 | "text.autoconfig.mousedanmu.option.gift.color": "Color", 27 | "text.autoconfig.mousedanmu.option.gift.color1": ">=Price1 Color", 28 | "text.autoconfig.mousedanmu.option.gift.color2": ">=Price2 Color", 29 | "text.autoconfig.mousedanmu.option.gift.color3": ">=Price3 Color", 30 | "text.autoconfig.mousedanmu.option.gift.color4": ">=Price4 Color", 31 | "text.autoconfig.mousedanmu.option.gift.isShow": "Show Gifts", 32 | "text.autoconfig.mousedanmu.option.gift.isShowFreeGiftToOverlayMessage": "Show Free Gifts in Overlay", 33 | "text.autoconfig.mousedanmu.option.gift.price1": "Price1", 34 | "text.autoconfig.mousedanmu.option.gift.price2": "Price2", 35 | "text.autoconfig.mousedanmu.option.gift.price3": "Price3", 36 | "text.autoconfig.mousedanmu.option.gift.price4": "Price4", 37 | "text.autoconfig.mousedanmu.option.guard.color": "Normal User Color", 38 | "text.autoconfig.mousedanmu.option.guard.isShow": "Show Guard Messages", 39 | "text.autoconfig.mousedanmu.option.guard.level1": "Governor", 40 | "text.autoconfig.mousedanmu.option.guard.level2": "Admiral", 41 | "text.autoconfig.mousedanmu.option.guard.level3": "Captain", 42 | "text.autoconfig.mousedanmu.option.liveRoom.autoConnect": "Automatic Connection", 43 | "text.autoconfig.mousedanmu.option.liveRoom.autoConnect.@Tooltip": "Automatically connect to the live room after joining the game", 44 | "text.autoconfig.mousedanmu.option.liveRoom.history": "Connection History", 45 | "text.autoconfig.mousedanmu.option.liveRoom.roomId": "Live Room ID", 46 | "text.autoconfig.mousedanmu.option.liveRoom.roomId.@Tooltip": "The number shown in the browser URL", 47 | "text.autoconfig.mousedanmu.option.liveRoom.cookie": "Cookie", 48 | "text.autoconfig.mousedanmu.option.liveRoom.cookie.@Tooltip": "Cookie is optional, refer to the repository for details", 49 | "text.autoconfig.mousedanmu.option.superChat.color": "Color", 50 | "text.autoconfig.mousedanmu.option.superChat.color.@Tooltip": "Color only affects the chat box, the Boss box has color limitations", 51 | "text.autoconfig.mousedanmu.option.superChat.color100": "Color for 100 Level", 52 | "text.autoconfig.mousedanmu.option.superChat.color1000": "Color for 1000 Level", 53 | "text.autoconfig.mousedanmu.option.superChat.color2000": "Color for 2000 Level", 54 | "text.autoconfig.mousedanmu.option.superChat.color50": "Color for 50 Level", 55 | "text.autoconfig.mousedanmu.option.superChat.color500": "Color for 500 Level", 56 | "text.autoconfig.mousedanmu.option.superChat.isShowBossBar": "Show in Boss Bar", 57 | "text.autoconfig.mousedanmu.option.superChat.isShowChat": "Show in Chat Box", 58 | "text.autoconfig.mousedanmu.title": "MouseDanmu Options", 59 | "text.mousedanmu.attention-live-room": "Followed the Streamer", 60 | "text.mousedanmu.click-to-user-space": "Click to Open User Space", 61 | "text.mousedanmu.click-to-view-emoji": "Click to View Emoticons", 62 | "text.mousedanmu.entry-live-room": "Entered Live Room", 63 | "text.mousedanmu.live-room-closed": "Disconnected", 64 | "text.mousedanmu.live-room-closing": "Closing", 65 | "text.mousedanmu.live-room-connected": "Connected: %d", 66 | "text.mousedanmu.mutual-attention-live-room": "Mutually Followed the Streamer", 67 | "text.mousedanmu.open-live-room": "Click to Open Live Room", 68 | "text.mousedanmu.share-live-room": "Shared the Live Room", 69 | "text.mousedanmu.special-attention-live-room": "Specially Followed the Streamer" 70 | } 71 | -------------------------------------------------------------------------------- /src/main/resources/assets/mousedanmu/lang/zh_cn.json: -------------------------------------------------------------------------------- 1 | { 2 | "modmenu.nameTranslation.mousedanmu": "鼠鼠弹幕", 3 | "modmenu.descriptionTranslation.mousedanmu": "可以看哔哩哔哩直播弹幕!\n 使用 '/mousedanmu' 或 '/dm' 控制\n '/dm connect 直播间号' 连接直播间\n点击网站按钮获取更多使用帮助\n\n免责声明:\n本模组用于获取哔哩哔哩直播的弹幕并在《我的世界》游戏聊天框中显示,提供了使用用户Cookie获取弹幕信息及发送弹幕的功能。\n\n请注意:\n1. 使用用户Cookie获取弹幕信息或发送弹幕,可能存在被哔哩哔哩封禁账号的风险,尽管目前尚无明确案例。\n2. 如果在使用本模组时进行《我的世界》直播,尽管游戏聊天框显示的弹幕来自哔哩哔哩,但不合规的弹幕可能导致直播间被封禁。\n\n使用本模组即表示您理解并接受以上风险,开发者不对因使用本模组导致的任何账号或直播间封禁承担责任。", 4 | "mousedanmu.bilibili": "哔哩哔哩", 5 | "mousedanmu.qun": "QQ群", 6 | "text.autoconfig.mousedanmu.category.danmu": "弹幕", 7 | "text.autoconfig.mousedanmu.category.gift": "礼物", 8 | "text.autoconfig.mousedanmu.category.guard": "大航海", 9 | "text.autoconfig.mousedanmu.category.liveRoom": "直播间", 10 | "text.autoconfig.mousedanmu.category.superChat": "醒目留言", 11 | "text.autoconfig.mousedanmu.option.danmu.emojiColor": "表情颜色", 12 | "text.autoconfig.mousedanmu.option.danmu.fansColor": "粉丝团1到4级", 13 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan12": "粉丝团大于12级", 14 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan16": "粉丝团大于16级", 15 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan20": "粉丝团大于20级", 16 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan24": "粉丝团大于24级", 17 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan28": "粉丝团大于28级", 18 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan4": "粉丝团大于4级", 19 | "text.autoconfig.mousedanmu.option.danmu.fansLargerThan8": "粉丝团大于8级", 20 | "text.autoconfig.mousedanmu.option.danmu.interactiveColor": "互动消息颜色", 21 | "text.autoconfig.mousedanmu.option.danmu.isShow": "显示弹幕", 22 | "text.autoconfig.mousedanmu.option.danmu.isShowEmoji": "显示表情", 23 | "text.autoconfig.mousedanmu.option.danmu.isShowFansMedal": "显示粉丝团勋章", 24 | "text.autoconfig.mousedanmu.option.danmu.isShowInteractive": "显示互动消息到聊天框", 25 | "text.autoconfig.mousedanmu.option.danmu.isShowInteractiveToOverlayMessage": "显示互动消息到屏幕中间", 26 | "text.autoconfig.mousedanmu.option.gift.color": "颜色", 27 | "text.autoconfig.mousedanmu.option.gift.color1": ">=金额1的颜色", 28 | "text.autoconfig.mousedanmu.option.gift.color2": ">=金额2的颜色", 29 | "text.autoconfig.mousedanmu.option.gift.color3": ">=金额3的颜色", 30 | "text.autoconfig.mousedanmu.option.gift.color4": ">=金额4的颜色", 31 | "text.autoconfig.mousedanmu.option.gift.isShow": "显示礼物", 32 | "text.autoconfig.mousedanmu.option.gift.isShowFreeGiftToOverlayMessage": "免费礼物显示到屏幕中间", 33 | "text.autoconfig.mousedanmu.option.gift.price1": "金额1", 34 | "text.autoconfig.mousedanmu.option.gift.price2": "金额2", 35 | "text.autoconfig.mousedanmu.option.gift.price3": "金额3", 36 | "text.autoconfig.mousedanmu.option.gift.price4": "金额4", 37 | "text.autoconfig.mousedanmu.option.guard.color": "普通用户", 38 | "text.autoconfig.mousedanmu.option.guard.isShow": "显示上船消息", 39 | "text.autoconfig.mousedanmu.option.guard.level1": "总督", 40 | "text.autoconfig.mousedanmu.option.guard.level2": "提督", 41 | "text.autoconfig.mousedanmu.option.guard.level3": "舰长", 42 | "text.autoconfig.mousedanmu.option.liveRoom.autoConnect": "自动连接", 43 | "text.autoconfig.mousedanmu.option.liveRoom.autoConnect.@Tooltip": "是否在加入游戏时连接到下面填写的直播间", 44 | "text.autoconfig.mousedanmu.option.liveRoom.history": "连接历史", 45 | "text.autoconfig.mousedanmu.option.liveRoom.roomId": "直播间号", 46 | "text.autoconfig.mousedanmu.option.liveRoom.roomId.@Tooltip": "一般是浏览器地址里显示的那串数字", 47 | "text.autoconfig.mousedanmu.option.liveRoom.cookie": "Cookie", 48 | "text.autoconfig.mousedanmu.option.liveRoom.cookie.@Tooltip": "Cookie是可选的,具体看仓库中的说明", 49 | "text.autoconfig.mousedanmu.option.superChat.color": "颜色", 50 | "text.autoconfig.mousedanmu.option.superChat.color.@Tooltip": "颜色只对聊天框有效,Boss框对颜色有限制", 51 | "text.autoconfig.mousedanmu.option.superChat.color100": "100档颜色", 52 | "text.autoconfig.mousedanmu.option.superChat.color1000": "1000档颜色", 53 | "text.autoconfig.mousedanmu.option.superChat.color2000": "2000档颜色", 54 | "text.autoconfig.mousedanmu.option.superChat.color50": "50档颜色", 55 | "text.autoconfig.mousedanmu.option.superChat.color500": "500档颜色", 56 | "text.autoconfig.mousedanmu.option.superChat.isShowBossBar": "显示到Boss框", 57 | "text.autoconfig.mousedanmu.option.superChat.isShowChat": "显示到聊天框", 58 | "text.autoconfig.mousedanmu.title": "鼠鼠弹幕选项", 59 | "text.mousedanmu.attention-live-room": "关注了主播", 60 | "text.mousedanmu.click-to-user-space": "点击打开用户主页", 61 | "text.mousedanmu.click-to-view-emoji": "点击查看表情", 62 | "text.mousedanmu.entry-live-room": "进入直播间", 63 | "text.mousedanmu.live-room-closed": "已断开", 64 | "text.mousedanmu.live-room-closing": "正在关闭", 65 | "text.mousedanmu.live-room-connected": "已连接:%d", 66 | "text.mousedanmu.mutual-attention-live-room": "互粉了主播", 67 | "text.mousedanmu.open-live-room": "点击打开直播间", 68 | "text.mousedanmu.share-live-room": "分享了直播间", 69 | "text.mousedanmu.special-attention-live-room": "特别关注了主播" 70 | } -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "mousedanmu", 4 | "version": "${version}", 5 | "name": "鼠鼠弹幕", 6 | "description": "可以看哔哩哔哩直播弹幕!\n 使用 '/mousedanmu' 或 '/dm' 控制\n '/dm connect 直播间号' 连接直播间\n点击网站按钮获取更多使用帮助\n\n免责声明:\n本模组用于获取哔哩哔哩直播的弹幕并在《我的世界》游戏聊天框中显示,提供了使用用户Cookie获取弹幕信息及发送弹幕的功能。\n\n请注意:\n1. 使用用户Cookie获取弹幕信息或发送弹幕,可能存在被哔哩哔哩封禁账号的风险,尽管目前尚无明确案例。\n2. 如果在使用本模组时进行《我的世界》直播,尽管游戏聊天框显示的弹幕来自哔哩哔哩,但不合规的弹幕可能导致直播间被封禁。\n\n使用本模组即表示您理解并接受以上风险,开发者不对因使用本模组导致的任何账号或直播间封禁承担责任。", 7 | "authors": [ 8 | "立青" 9 | ], 10 | "contact": { 11 | "homepage": "https://gitee.com/LiQing-Code/mouse-danmu", 12 | "sources": "https://github.com/LiQing-Code/mouse-danmu", 13 | "issues": "https://github.com/LiQing-Code/mouse-danmu/issues" 14 | }, 15 | "license": "MIT", 16 | "icon": "assets/mousedanmu/icon.png", 17 | "environment": "client", 18 | "entrypoints": { 19 | "client": [ 20 | "cn.liqing.mousedanmu.MouseDanmu" 21 | ], 22 | "modmenu": [ 23 | "cn.liqing.mousedanmu.ModMenuIntegration" 24 | ] 25 | }, 26 | "depends": { 27 | "fabric": "*", 28 | "fabricloader": "*", 29 | "minecraft": ">=1.19", 30 | "cloth-config": ">=8.3.115" 31 | }, 32 | "custom": { 33 | "modmenu": { 34 | "links": { 35 | "mousedanmu.qun": "https://jq.qq.com/?_wv=1027&k=nImOUpnV", 36 | "mousedanmu.bilibili": "https://space.bilibili.com/345259002" 37 | } 38 | } 39 | } 40 | } 41 | --------------------------------------------------------------------------------