This commit is contained in:
BRanulf 2025-04-12 19:49:21 +08:00
parent 875d9ada1b
commit 0ee059d8ba
12 changed files with 122 additions and 23 deletions

View File

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.9.2'
id 'maven-publish'
}
@ -8,11 +8,13 @@ group = project.maven_group
repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/" }
maven {url "https://maven.terraformersmc.com/"}
}
dependencies {
// To change the versions see the gradle.properties file
// implementation files("libs/modmenu-13.0.3.jar")
// implementation files("libs/modmenu-13.0.3.pom")
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
@ -20,11 +22,12 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
include modApi("me.shedaniel.cloth:cloth-config-fabric:15.0.127") {
include modApi("me.shedaniel.cloth:cloth-config-fabric:17.0.142") {
exclude(group: "net.fabricmc.fabric-api")
}
modCompileOnly("com.terraformersmc:modmenu:10.0.0-beta.1")
// modCompileOnly("com.terraformersmc:modmenu:13.0.3")
modCompileOnly files("libs/modmenu-13.0.3.jar")
}
processResources {

View File

@ -2,13 +2,16 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
minecraft_version=1.21.4
yarn_mappings=1.21.4+build.8
loader_version=0.16.10
# Mod Properties
mod_version=1.7.0
mod_version=1.14.514
maven_group=semmiedev
archives_base_name=disc_jockey
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.100.1+1.21
fabric_version=0.119.2+1.21.4
systemProp.http.sslVerify=false
systemProp.https.sslVerify=false
systemProp.javax.net.ssl.trustStoreType=WINDOWS-ROOT

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https://mirrors.aliyun.com/macports/distfiles/gradle/gradle-8.12.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

8
libs/modmenu-13.0.3.pom Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.terraformersmc</groupId>
<artifactId>modmenu</artifactId>
<version>13.0.3</version>
</project>

View File

@ -181,7 +181,7 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
}
Vec3d unit = Vec3d.ofCenter(blockPos, 0.5).subtract(client.player.getEyePos()).normalize();
if((lastLookSentAt == -1L || now - lastLookSentAt >= 50) && last100MsSpanEstimatedPackets < last100MsReducePacketsAfter && (reducePacketsUntil == -1L || reducePacketsUntil < now)) {
client.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(MathHelper.wrapDegrees((float) (MathHelper.atan2(unit.z, unit.x) * 57.2957763671875) - 90.0f), MathHelper.wrapDegrees((float) (-(MathHelper.atan2(unit.y, Math.sqrt(unit.x * unit.x + unit.z * unit.z)) * 57.2957763671875))), true));
client.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(MathHelper.wrapDegrees((float) (MathHelper.atan2(unit.z, unit.x) * 57.2957763671875) - 90.0f), MathHelper.wrapDegrees((float) (-(MathHelper.atan2(unit.y, Math.sqrt(unit.x * unit.x + unit.z * unit.z)) * 57.2957763671875))), true, false));
last100MsSpanEstimatedPackets++;
lastLookSentAt = now;
}else if(last100MsSpanEstimatedPackets >= last100MsReducePacketsAfter){

View File

@ -70,7 +70,7 @@ public class SongListWidget extends EntryListWidget<SongListWidget.SongEntry> {
context.drawCenteredTextWithShadow(client.textRenderer, song.displayName, x + entryWidth / 2, y + 5, selected ? 0xFFFFFF : 0x808080);
RenderSystem.setShaderTexture(0, ICONS);
context.drawTexture(ICONS, x + 2, y + 2, (favorite ? 26 : 0) + (isOverFavoriteButton(mouseX, mouseY) ? 13 : 0), 0, 13, 12, 52, 12);
// context.drawTexture(ICONS, x + 2, y + 2, (favorite ? 26 : 0) + (isOverFavoriteButton(mouseX, mouseY) ? 13 : 0), 0, 13, 12, 52, 12);
}
@Override

View File

@ -18,8 +18,8 @@ public class BlocksOverlay {
public static void render(DrawContext context, RenderTickCounter tickCounter) {
if (itemStacks != null) {
context.fill(2, 2, 62, (itemStacks.length + 1) * 20 + 7, ColorHelper.Argb.getArgb(255, 22, 22, 27));
context.fill(4, 4, 60, (itemStacks.length + 1) * 20 + 5, ColorHelper.Argb.getArgb(255, 42, 42, 47));
context.fill(2, 2, 62, (itemStacks.length + 1) * 20 + 7, ColorHelper.getArgb(255, 22, 22, 27));
context.fill(4, 4, 60, (itemStacks.length + 1) * 20 + 5, ColorHelper.getArgb(255, 42, 42, 47));
MinecraftClient client = MinecraftClient.getInstance();
TextRenderer textRenderer = client.textRenderer;

View File

@ -143,7 +143,7 @@ public class DiscJockeyScreen extends Screen {
if (shouldFilter) {
shouldFilter = false;
songListWidget.setScrollAmount(0);
// songListWidget.setScrollAmount(0);
songListWidget.children().clear();
boolean empty = query.isEmpty();
int favoriteIndex = 0;
@ -160,7 +160,7 @@ public class DiscJockeyScreen extends Screen {
}
@Override
public void filesDragged(List<Path> paths) {
public void onFilesDropped(List<Path> paths) {
String string = paths.stream().map(Path::getFileName).map(Path::toString).collect(Collectors.joining(", "));
if (string.length() > 300) string = string.substring(0, 300)+"...";

View File

@ -19,11 +19,39 @@ import semmiedev.disc_jockey.Main;
public class ClientWorldMixin {
@Shadow @Final private MinecraftClient client;
@Inject(method = "playSound(DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFZJ)V", at = @At("HEAD"), cancellable = true)
private void makeNoteBlockSoundsOmnidirectional(double x, double y, double z, SoundEvent event, SoundCategory category, float volume, float pitch, boolean useDistance, long seed, CallbackInfo ci) {
if (((Main.config.omnidirectionalNoteBlockSounds && Main.SONG_PLAYER.running) || Main.PREVIEWER.running) && event.getId().getPath().startsWith("block.note_block")) {
@Inject(
method = "playSound(DDDLnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFZJ)V",
at = @At("HEAD"),
cancellable = true
)
private void makeNoteBlockSoundsOmnidirectional(
double x, double y, double z,
SoundEvent event,
SoundCategory category,
float volume, float pitch,
boolean useDistance, long seed,
CallbackInfo ci
) {
if (
((Main.config.omnidirectionalNoteBlockSounds && Main.SONG_PLAYER.running) || Main.PREVIEWER.running) &&
// 关键修改点event.id() 替代 event.getId()
event.id().getPath().startsWith("block.note_block")
) {
ci.cancel();
client.getSoundManager().play(new PositionedSoundInstance(event.getId(), category, volume, pitch, Random.create(seed), false, 0, SoundInstance.AttenuationType.NONE, 0, 0, 0, true));
client.getSoundManager().play(
new PositionedSoundInstance(
event.id(), // 同样需要修改此处
category,
volume,
pitch,
Random.create(seed),
false,
0,
SoundInstance.AttenuationType.NONE,
0, 0, 0,
true
)
);
}
}
}

View File

@ -0,0 +1,55 @@
{
"disc_jockey.screen.select_song": "选择歌曲",
"disc_jockey.screen.play": "播放",
"disc_jockey.screen.play.stop": "停止播放",
"disc_jockey.screen.preview": "试听",
"disc_jockey.screen.preview.stop": "停止试听",
"disc_jockey.screen.blocks.title": "音符盒",
"disc_jockey.screen.blocks": "音符盒",
"disc_jockey.screen.search": "搜索歌曲",
"disc_jockey.screen.drop_hint": "将歌曲文件拖入此窗口以添加",
"disc_jockey.screen.drop_confirm": "是否将以下歌曲添加到 Disc Jockey",
"disc_jockey.player.invalid_note_blocks": "附近的音符盒配置不正确。缺失:",
"disc_jockey.player.invalid_game_mode": "无法在 %s 模式下播放",
"disc_jockey.player.to_far": "你距离太远了",
"disc_jockey.still_loading": "歌曲仍在加载中",
"disc_jockey.reloading": "正在重新加载所有歌曲",
"disc_jockey.loading_done": "所有歌曲已加载完成",
"disc_jockey.song_not_found": "歌曲“%s”不存在",
"disc_jockey.not_playing": "未播放任何歌曲",
"disc_jockey.speed_changed": "播放速度已调整为 %s",
"disc_jockey.stopped_playing": "已停止播放“%s”",
"disc_jockey.info_not_running": "未播放歌曲(速度:%s",
"disc_jockey.info_tuning": "调音中(速度:%s",
"disc_jockey.info_playing": "播放中:[%s/%s] %s速度%s",
"disc_jockey.info_finished": "已播放:%s速度%s",
"disc_jockey.instrument_info": "此功能可将音符盒的乐器映射为其他乐器音色。",
"disc_jockey.invalid_instrument": "无效乐器:%s",
"disc_jockey.instrument_mapped": "已将 %s 映射为 %s",
"disc_jockey.instrument_mapped_all": "已将全部乐器映射为 %s",
"disc_jockey.instrument_unmapped": "已取消 %s 的映射",
"disc_jockey.mapped_instruments": "已映射乐器:%s",
"disc_jockey.no_mapped_instruments": "当前未映射任何乐器",
"disc_jockey.instrument_maps_cleared": "已清除所有乐器映射",
"disc_jockey.loop_status": "循环播放:%s",
"disc_jockey.loop_enabled": "已启用当前歌曲循环播放",
"disc_jockey.loop_disabled": "已禁用当前歌曲循环播放",
"disc_jockey.warning": "警告!此模组极易被误判为作弊工具,使用前请联系服务器管理员!(可在模组设置中关闭此警告)\n当前版本1.14.5141.21.4为非官方版本由BRanulf改版翻译也是这家伙提供的。\n仅供学习参考请支持官方别找我XD",
"key.category.disc_jockey": "Disc Jockey",
"disc_jockey.key_bind.open_screen": "打开歌曲选择界面",
"text.autoconfig.disc_jockey.title": "Disc Jockey",
"text.autoconfig.disc_jockey.option.hideWarning": "隐藏警告",
"text.autoconfig.disc_jockey.option.disableAsyncPlayback": "禁用异步播放",
"text.autoconfig.disc_jockey.option.disableAsyncPlayback.@Tooltip[0]": "强制音符与客户端刻同步播放,而非使用独立线程。",
"text.autoconfig.disc_jockey.option.disableAsyncPlayback.@Tooltip[1]": "可能导致性能下降(尤其在低帧率时),但可解决某些情况下无法播放的问题。",
"text.autoconfig.disc_jockey.option.omnidirectionalNoteBlockSounds": "全向音符盒音效(客户端)",
"text.autoconfig.disc_jockey.option.omnidirectionalNoteBlockSounds.@Tooltip[0]": "使音符盒音效全向传播,提升听觉体验",
"text.autoconfig.disc_jockey.option.omnidirectionalNoteBlockSounds.@Tooltip[1]": "若不确定效果,建议直接试听对比",
"text.autoconfig.disc_jockey.option.expectedServerVersion": "预期服务器版本",
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[0]": "选择你预计使用此模组的服务器版本。",
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[1]": "此设置影响音符盒可触达范围的判定逻辑。",
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[2]": "版本选择错误可能导致无法触发部分音符盒,影响播放效果",
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[3]": "若不确认版本,或需兼容多版本服务器,请选择“全部”",
"text.autoconfig.disc_jockey.option.delayPlaybackStartBySecs": "播放延迟(秒)",
"text.autoconfig.disc_jockey.option.delayPlaybackStartBySecs.@Tooltip": "调音完成后延迟指定秒数再开始播放(如 0.5 表示延迟半秒)。"
}

View File

@ -2,7 +2,7 @@
"required": true,
"minVersion": "0.8",
"package": "semmiedev.disc_jockey.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"mixins": [
"ClientWorldMixin"
],

View File

@ -6,7 +6,8 @@
"description": "Play note block songs in Minecraft",
"authors": [
"SemmieDev",
"EnderKill98"
"EnderKill98",
"BRanulf(非正式)"
],
"contact": {
"repo": "https://github.com/SemmieDev/Disc-Jockey"
@ -27,7 +28,8 @@
],
"depends": {
"fabric": "*",
"minecraft": "~1.21",
"minecraft": "~1.21.4",
"java": ">=21",
"cloth-config": "*"
}
}