Skip to content

Commit

Permalink
Workaround for a rare logspam issue on Forge
Browse files Browse the repository at this point in the history
  • Loading branch information
Adubbz committed Jan 5, 2024
1 parent cccc98f commit e41f8eb
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public static void onTooltip(ItemTooltipEvent event)
if (!Environment.isClient())
throw new IllegalStateException("ItemTooltipEvent unexpectedly called on the server");

// In some rare cases (on Forge at least) this may be called with a null connection
if (Minecraft.getInstance().getConnection() == null)
return;

ItemStack stack = event.getStack();
Block block = Block.byItem(stack.getItem());
BlockState state = block.defaultBlockState();
Expand Down

0 comments on commit e41f8eb

Please sign in to comment.