Skip to content

Commit 621fb29

Browse files
committed
minor fix
1 parent c5807f5 commit 621fb29

5 files changed

Lines changed: 14 additions & 8 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ mod_name=Channel
3030
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3131
mod_license=GNU GPL 3.0
3232
# The mod version. See https://semver.org/
33-
mod_version=26.1-0+alpha
33+
mod_version=26.1-1+alpha
3434
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
3535
# This should match the base package used for the mod sources.
3636
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/cn/ussshenzhou/channel/audio/client/receive/PlayerAudio.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public List<ByteBuffer> read(int sizeIn10Ms) {
8181
}
8282

8383
public void checkTooMuchDelay() {
84-
if (audioBuffer.size() >= MAX_BUFFER_10MS) {
85-
int targetBufferSize = (int) (ChannelClientConfig.get().networkTolerance * 1.5 / 10);
84+
if (audioBuffer.size() >= ChannelClientConfig.get().networkTolerance * 1.5 || audioBuffer.size() >= MAX_BUFFER_10MS) {
85+
int targetBufferSize = (int) (ChannelClientConfig.get().networkTolerance * 1.1 / 10);
8686
int drop = audioBuffer.size() - targetBufferSize;
8787
for (int i = 0; i < drop; i++) {
8888
audioBuffer.poll();

src/main/java/cn/ussshenzhou/channel/gui/LoginNotificationHelper.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import cn.ussshenzhou.channel.input.ModKeyMappingRegistry;
44
import cn.ussshenzhou.t88.gui.notification.TSimpleNotification;
5-
import net.minecraft.client.Minecraft;
65
import net.minecraft.network.chat.Component;
76
import net.neoforged.api.distmarker.Dist;
87
import net.neoforged.bus.api.SubscribeEvent;
98
import net.neoforged.fml.common.EventBusSubscriber;
10-
import net.neoforged.neoforge.event.level.LevelEvent;
11-
import net.neoforged.neoforge.server.ServerLifecycleHooks;
9+
import net.neoforged.neoforge.client.event.ClientPlayerNetworkEvent;
1210

1311
/**
1412
* @author USS_Shenzhou
@@ -17,7 +15,7 @@
1715
public class LoginNotificationHelper {
1816

1917
@SubscribeEvent
20-
public static void showNotification(LevelEvent.Load event) {
18+
public static void showNotification(ClientPlayerNetworkEvent.LoggingIn event) {
2119
TSimpleNotification.fire(
2220
Component.translatable("channel.welcome",
2321
ModKeyMappingRegistry.CONFIG.getKeyModifier().getCombinedName(ModKeyMappingRegistry.CONFIG.getKey(), () -> ModKeyMappingRegistry.CONFIG.getKey().getDisplayName()).getString()

src/main/java/cn/ussshenzhou/channel/gui/OutputConfigPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public OutputConfigPanel() {
3737
entry -> entry.getContent() == cfg.rayTraceAudio
3838
).getB().setTooltip(Tooltip.create(Component.translatable("channel.config.post.rt.tooltip")));
3939
addOptionSliderDoubleInit(Component.translatable("channel.config.post.delay"),
40-
20, 3000,
40+
20, 2000,
4141
(_, v) -> Component.literal(v.intValue() + "ms"),
4242
Component.translatable("channel.config.post.delay.tooltip"),
4343
(slider, _) -> {

src/main/java/cn/ussshenzhou/channel/gui/hud/MicrophoneHud.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import cn.ussshenzhou.t88.gui.widegt.TImage;
1010
import cn.ussshenzhou.t88.gui.widegt.TPanel;
1111
import cn.ussshenzhou.t88.gui.widegt.TProgressBar;
12+
import net.minecraft.client.Minecraft;
1213
import net.minecraft.client.gui.GuiGraphicsExtractor;
14+
import net.minecraft.client.gui.screens.ChatScreen;
1315
import net.minecraft.resources.Identifier;
1416
import net.minecraft.util.Mth;
1517
import net.neoforged.api.distmarker.Dist;
@@ -41,6 +43,7 @@ public static void onPlayerOut(ClientPlayerNetworkEvent.LoggingOut event) {
4143
private final TImage word = new TImage(Identifier.fromNamespaceAndPath(Channel.MODID, "textures/gui/standby.png"));
4244
private final TImage shadow = new TImage(Identifier.fromNamespaceAndPath(Channel.MODID, "textures/gui/standby.png"));
4345
private final TImage slash = new TImage(Identifier.fromNamespaceAndPath(Channel.MODID, "textures/gui/slash.png"));
46+
private boolean render = true;
4447

4548
public MicrophoneHud() {
4649
this.add(microphone);
@@ -74,6 +77,8 @@ public void tickT() {
7477

7578
word.setVisibleT(cfg.showHudText);
7679
shadow.setVisibleT(cfg.showHudText);
80+
81+
render = !(Minecraft.getInstance().screen instanceof ChatScreen);
7782
super.tickT();
7883
}
7984

@@ -99,6 +104,9 @@ public void layout() {
99104

100105
@Override
101106
public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mouseY, float pPartialTick) {
107+
if (!render) {
108+
return;
109+
}
102110
var word = Identifier.fromNamespaceAndPath(Channel.MODID, "textures/gui/" + status.name().toLowerCase() + ".png");
103111
this.word.setImageLocation(word);
104112
this.shadow.setImageLocation(word);

0 commit comments

Comments
 (0)