Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

The Box

Members
  • Joined

  • Last visited

  1. How do I take a screenshot on the client when an item is right clicked and then send that image over to the server in a packet and use it there?
  2. I fixed this by removing the "!" on "!worldIn.isRemote"
  3. I'm trying to take a screenshot and then save that in Item nbt with a byte array: @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (!worldIn.isRemote) { ItemStack stack = new ItemStack(ModItems.PICTURE); NBTTagCompound nbt; if (stack.hasTagCompound()) { nbt = stack.getTagCompound(); } else { nbt = new NBTTagCompound(); } BufferedImage screenshot = new ScreenShotHelper().createScreenshot(Main.mc.displayWidth, Main.mc.displayHeight, Main.mc.getFramebuffer()); byte[] bytes = null; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); boolean foundWriter; foundWriter = ImageIO.write(screenshot, "jpg", baos); assert foundWriter; bytes = baos.toByteArray(); } catch (IOException e) { e.printStackTrace(); } nbt.setByteArray("Picture", bytes); stack.setTagCompound(nbt); } return super.onItemRightClick(worldIn, playerIn, handIn); } But I get the error: java.util.concurrent.ExecutionException: java.lang.RuntimeException: No OpenGL context found in the current thread. at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_192] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_192] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_192] Caused by: java.lang.RuntimeException: No OpenGL context found in the current thread. at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124) ~[lwjgl-2.9.4-nightly-20150209.jar:?] at org.lwjgl.opengl.GL11.glPixelStorei(GL11.java:2155) ~[lwjgl-2.9.4-nightly-20150209.jar:?] at net.minecraft.client.renderer.GlStateManager.glPixelStorei(GlStateManager.java:806) ~[GlStateManager.class:?] at net.minecraft.util.ScreenShotHelper.createScreenshot(ScreenShotHelper.java:99) ~[ScreenShotHelper.class:?] at com.thebox.guac.items.ItemCamera.onItemRightClick(ItemCamera.java:53) ~[ItemCamera.class:?] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:234) ~[ItemStack.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClick(PlayerInteractionManager.java:384) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processTryUseItem(NetHandlerPlayServer.java:796) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:43) ~[CPacketPlayerTryUseItem.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:9) ~[CPacketPlayerTryUseItem.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_192] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_192] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 5 more Anyone know why? (I'm new to Java/Modding)

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.