Skip to content

Commit 4144344

Browse files
authored
Merge pull request cabaletta#4251 from wagyourtail/1.19/fix/feather-crash
Fix feather crashing by catching error
2 parents e962c39 + d51b23b commit 4144344

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/api/java/baritone/api/Settings.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import net.minecraft.world.item.Item;
3030
import net.minecraft.world.level.block.Block;
3131
import net.minecraft.world.level.block.Blocks;
32+
import org.slf4j.Logger;
33+
import org.slf4j.LoggerFactory;
3234

3335
import java.awt.*;
3436
import java.lang.annotation.ElementType;
@@ -50,6 +52,7 @@
5052
* @author leijurv
5153
*/
5254
public final class Settings {
55+
private static final Logger LOGGER = LoggerFactory.getLogger("Baritone");
5356

5457
/**
5558
* Allow Baritone to break blocks
@@ -1216,8 +1219,12 @@ public final class Settings {
12161219
*/
12171220
@JavaOnly
12181221
public final Setting<Consumer<Component>> logger = new Setting<>((msg) -> {
1219-
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
1220-
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
1222+
try {
1223+
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
1224+
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
1225+
} catch (Throwable t) {
1226+
LOGGER.warn("Failed to log message to chat: " + msg.getString(), t);
1227+
}
12211228
});
12221229

12231230
/**

0 commit comments

Comments
 (0)