Skip to content

Commit

Permalink
Merge pull request cabaletta#4251 from wagyourtail/1.19/fix/feather-c…
Browse files Browse the repository at this point in the history
…rash

Fix feather crashing by catching error
  • Loading branch information
leijurv authored Jan 23, 2024
2 parents e962c39 + d51b23b commit 4144344
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

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

/**
* Allow Baritone to break blocks
Expand Down Expand Up @@ -1216,8 +1219,12 @@ public final class Settings {
*/
@JavaOnly
public final Setting<Consumer<Component>> logger = new Setting<>((msg) -> {
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
try {
final GuiMessageTag tag = useMessageTag.value ? Helper.MESSAGE_TAG : null;
Minecraft.getInstance().gui.getChat().addMessage(msg, null, tag);
} catch (Throwable t) {
LOGGER.warn("Failed to log message to chat: " + msg.getString(), t);
}
});

/**
Expand Down

0 comments on commit 4144344

Please sign in to comment.