@SubscribeEvent public void onInventoryRendering(GuiScreenEvent.DrawScreenEvent.Post post) { try { //basically check if in the right menu List<List<String>> tooltipList = new ArrayList<>(); thread = new Thread(() -> { try { while (true) { isrunning = true; for (int i = 0; i < 20; i++) { final int index = i; ItemStack stack = chest.getSlot(i).getStack(); if (stack != null) { tooltipList.add(stack.getTooltip(Minecraft.getMinecraft().thePlayer, false)); } Thread.sleep(1); } } if (tooltipList.size() > 0) { socketSender.SendTooltips(tooltipList); } } } catch (Exception e) { e.printStackTrace(); } }); if (!isrunning) { thread.start(); } } } } } catch (Exception e) { } }
if (tooltipList.size() > 0) { socketSender.SendTooltips(tooltipList);}
@EventHandler public void Init(FMLPreInitializationEvent event){ socketSender = new SocketSender("127.0.0.1", 5020); MinecraftForge.EVENT_BUS.register(this);}