huh?
This commit is contained in:
parent
f60886c6d9
commit
ad971a375b
@ -6,7 +6,7 @@ minecraft_version=1.21.4
|
||||
yarn_mappings=1.21.4+build.8
|
||||
loader_version=0.16.10
|
||||
# Mod Properties
|
||||
mod_version=1.14.514.043
|
||||
mod_version=1.14.514.044
|
||||
maven_group=semmiedev
|
||||
archives_base_name=disc_jockey_revive
|
||||
# Dependencies
|
||||
|
@ -12,6 +12,9 @@ public class ModConfig implements ConfigData {
|
||||
@ConfigEntry.Gui.Tooltip(count = 2) public boolean disableAsyncPlayback;
|
||||
@ConfigEntry.Gui.Tooltip(count = 2) public boolean omnidirectionalNoteBlockSounds = true;
|
||||
|
||||
@ConfigEntry.Gui.Tooltip(count = 1)
|
||||
public boolean forceOmnidirectionalNoteBlockSounds = false;
|
||||
|
||||
@ConfigEntry.Gui.Excluded
|
||||
public String currentFolderPath = "";
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package semmiedev.disc_jockey_revive.gui.screen;
|
||||
|
||||
import me.shedaniel.autoconfig.AutoConfig;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.ConfirmScreen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
@ -30,7 +31,7 @@ import semmiedev.disc_jockey_revive.SongPlayer.PlayMode;
|
||||
import static net.minecraft.client.toast.TutorialToast.PROGRESS_BAR_WIDTH;
|
||||
|
||||
public class DiscJockeyScreen extends Screen {
|
||||
private static final MutableText
|
||||
public static final MutableText
|
||||
SELECT_SONG = Text.translatable(Main.MOD_ID+".screen.select_song"),
|
||||
PLAY = Text.translatable(Main.MOD_ID+".screen.play"),
|
||||
PLAY_STOP = Text.translatable(Main.MOD_ID+".screen.play.stop").formatted(Formatting.YELLOW),
|
||||
@ -39,12 +40,12 @@ public class DiscJockeyScreen extends Screen {
|
||||
DROP_HINT = Text.translatable(Main.MOD_ID+".screen.drop_hint").formatted(Formatting.GRAY)
|
||||
;
|
||||
|
||||
private SongListWidget songListWidget;
|
||||
private ButtonWidget playButton, previewButton;
|
||||
public SongListWidget songListWidget;
|
||||
public ButtonWidget playButton, previewButton;
|
||||
public boolean shouldFilter;
|
||||
private String query = "";
|
||||
public String query = "";
|
||||
|
||||
private static final MutableText
|
||||
public static final MutableText
|
||||
FOLDER_UP = Text.literal("↑"),
|
||||
CURRENT_FOLDER = Text.translatable(Main.MOD_ID+".screen.current_folder"),
|
||||
PLAY_MODE = Text.translatable(Main.MOD_ID+".screen.play_mode"),
|
||||
@ -53,19 +54,21 @@ public class DiscJockeyScreen extends Screen {
|
||||
MODE_RANDOM = Text.translatable(Main.MOD_ID+".screen.mode_random"),
|
||||
MODE_STOP = Text.translatable(Main.MOD_ID+".screen.mode_stop");
|
||||
|
||||
private static final MutableText
|
||||
public static final MutableText
|
||||
OPEN_FOLDER = Text.translatable(Main.MOD_ID+".screen.open_folder"),
|
||||
RELOAD = Text.translatable(Main.MOD_ID+".screen.reload"),
|
||||
LIVE_DJ = Text.translatable(Main.MOD_ID+".screen.live_dj").formatted(Formatting.GOLD);
|
||||
|
||||
private ButtonWidget folderUpButton, playModeButton;
|
||||
public ButtonWidget folderUpButton, playModeButton;
|
||||
public SongFolder currentFolder;
|
||||
private PlayMode currentPlayMode = PlayMode.STOP_AFTER;
|
||||
public PlayMode currentPlayMode = PlayMode.STOP_AFTER;
|
||||
|
||||
private ProgressBarRenderer progressBarRenderer;
|
||||
public ProgressBarRenderer progressBarRenderer;
|
||||
|
||||
public CustomSliderWidget speedSlider;
|
||||
|
||||
public ButtonWidget configButton;
|
||||
|
||||
public DiscJockeyScreen() {
|
||||
super(Main.NAME);
|
||||
this.progressBarRenderer = new ProgressBarRenderer();
|
||||
@ -145,8 +148,18 @@ public class DiscJockeyScreen extends Screen {
|
||||
Main.SONG_PLAYER.speed = newSpeed;
|
||||
DebugLogger.log("播放速度设置为: {:.2f}x", newSpeed);
|
||||
}
|
||||
};
|
||||
addDrawableChild(speedSlider);
|
||||
}; if (isLargeScreen) addDrawableChild(speedSlider);
|
||||
|
||||
// 配置按钮
|
||||
int configButtonSize = 20;
|
||||
int configButtonX = width - 120 - sliderWidth - configButtonSize - 10;
|
||||
int configButtonY = 10;
|
||||
if (!isLargeScreen) configButtonX = width - 120 - configButtonSize - 10;
|
||||
configButton = ButtonWidget.builder(Text.literal("⚙"), button -> {
|
||||
Screen configScreen = AutoConfig.getConfigScreen(ModConfig.class, this).get();
|
||||
client.setScreen(configScreen);
|
||||
}).dimensions(configButtonX, configButtonY, configButtonSize, configButtonSize).build();
|
||||
addDrawableChild(configButton);
|
||||
|
||||
int buttonY;
|
||||
if (isLargeScreen){
|
||||
|
@ -32,25 +32,41 @@ public class ClientWorldMixin {
|
||||
boolean useDistance, long seed,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
if (
|
||||
((Main.config.omnidirectionalNoteBlockSounds && Main.SONG_PLAYER.running) || Main.PREVIEWER.running) &&
|
||||
event.id().getPath().startsWith("block.note_block")
|
||||
) {
|
||||
boolean isNoteBlockSound = event.id().getPath().startsWith("block.note_block");
|
||||
|
||||
if (Main.config.forceOmnidirectionalNoteBlockSounds && isNoteBlockSound) {
|
||||
ci.cancel();
|
||||
client.getSoundManager().play(
|
||||
new PositionedSoundInstance(
|
||||
event.id(),
|
||||
category,
|
||||
volume,
|
||||
pitch,
|
||||
Random.create(seed),
|
||||
false,
|
||||
0,
|
||||
SoundInstance.AttenuationType.NONE,
|
||||
0, 0, 0,
|
||||
true
|
||||
)
|
||||
);
|
||||
playOmnidirectionalSound(event, category, volume, pitch, seed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Main.config.omnidirectionalNoteBlockSounds &&
|
||||
(Main.SONG_PLAYER.running || Main.PREVIEWER.running) &&
|
||||
isNoteBlockSound) {
|
||||
ci.cancel();
|
||||
playOmnidirectionalSound(event, category, volume, pitch, seed);
|
||||
}
|
||||
}
|
||||
|
||||
private void playOmnidirectionalSound(
|
||||
SoundEvent event,
|
||||
SoundCategory category,
|
||||
float volume, float pitch,
|
||||
long seed
|
||||
) {
|
||||
client.getSoundManager().play(
|
||||
new PositionedSoundInstance(
|
||||
event.id(),
|
||||
category,
|
||||
volume,
|
||||
pitch,
|
||||
Random.create(seed),
|
||||
false,
|
||||
0,
|
||||
SoundInstance.AttenuationType.NONE,
|
||||
0, 0, 0,
|
||||
true
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -104,5 +104,8 @@
|
||||
"disc_jockey_revive.playback_failure.next": "Play next song",
|
||||
"disc_jockey_revive.playback_failure.next_message": "Playback failure handling: Play next song.",
|
||||
|
||||
"command.failure_action.set": "Playback failure action set to: %s"
|
||||
"command.failure_action.set": "Playback failure action set to: %s",
|
||||
|
||||
"text.autoconfig.disc_jockey_revive.option.forceOmnidirectionalNoteBlockSounds": "Force Omnidirectional Note Blocks",
|
||||
"text.autoconfig.disc_jockey_revive.option.forceOmnidirectionalNoteBlockSounds.@Tooltip[0]": "Forces all note block sounds to be omnidirectional at all times.\nOverrides the regular omnidirectional setting."
|
||||
}
|
||||
|
@ -104,5 +104,8 @@
|
||||
"disc_jockey_revive.playback_failure.next": "播放下一首",
|
||||
"disc_jockey_revive.playback_failure.next_message": "播放失败处理:播放下一首",
|
||||
|
||||
"command.failure_action.set": "播放失败处理方式已设置为: %s"
|
||||
"command.failure_action.set": "播放失败处理方式已设置为: %s",
|
||||
|
||||
"text.autoconfig.disc_jockey_revive.option.forceOmnidirectionalNoteBlockSounds": "强制全向音符盒音效",
|
||||
"text.autoconfig.disc_jockey_revive.option.forceOmnidirectionalNoteBlockSounds.@Tooltip[0]": "强制所有音符盒音效始终保持全向传播\n会覆盖常规的全向音符盒设置"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user