mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-12 16:37:45 +00:00
Send chat to player when recipe loading was errored (#241)
This commit is contained in:
1 parent
8717df0cbb
commit
96e4fe55e8
3 files changed
+21
No files matched your search
@@ -6,8 +6,12 @@ import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import codechicken.nei.ItemPanels;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -37,6 +41,12 @@ public class GuiCraftingRecipe extends GuiRecipe
|
||||
.collect(Collectors.toCollection(ArrayList::new))).get());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null) {
|
||||
IChatComponent chat = new ChatComponentTranslation("nei.chat.recipe.error");
|
||||
chat.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
player.addChatComponentMessage(chat);
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
profiler.end();
|
||||
|
||||
@@ -6,6 +6,10 @@ import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -35,6 +39,12 @@ public class GuiUsageRecipe extends GuiRecipe
|
||||
.collect(Collectors.toCollection(ArrayList::new))).get());
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (player != null) {
|
||||
IChatComponent chat = new ChatComponentTranslation("nei.chat.recipe.error");
|
||||
chat.getChatStyle().setColor(EnumChatFormatting.RED);
|
||||
player.addChatComponentMessage(chat);
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
profiler.end();
|
||||
|
||||
Reference in new issue
Block a user