Jump to content

JooseMann

Members
  • Posts

    4
  • Joined

  • Last visited

JooseMann's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Ah, alright. I got it working with the use of ScreenEvent.Render.Post, which I hadn't known about prior. Thank you!
  2. Hi there, I am trying to add an image to the screen when the inventory is opened. So far, I've been able to get the image working (using RenderSystem and blit()), but it always appears behind the inventory (in other words, if you put one over the other, only the inventory will show). I have tried to use RenderSystem.depthFunc(519); (or depthFunc()) to set the image in front, but it still is displayed behind. (Also, just a heads up, the code doesn't bind the image to the mouse like I thought it would, but that is just for testing). Clearly, I'm missing something here. What function allows an image to be rendered in front of the inventory? Thanks, and if you see this then have a nice day My code so far: public static ResourceLocation LOCK = new ResourceLocation(ExampleMod.MOD_ID, "textures/gui/lock-opaque.png"); @SubscribeEvent public static void onGuiRender(RenderGuiOverlayEvent.Post event) { if (Minecraft.getInstance().player != null && Minecraft.getInstance().screen instanceof InventoryScreen) { renderOverlay(event.getPoseStack(), (int) Minecraft.getInstance().mouseHandler.xpos(), (int) Minecraft.getInstance().mouseHandler.ypos()); } } public static void renderOverlay(PoseStack poseStack, int x, int y) { RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f); RenderSystem.setShaderTexture(0, LOCK); RenderSystem.enableDepthTest(); RenderSystem.depthFunc(519); blit(poseStack, x, y, 0, 0, 16, 16, 16, 16); RenderSystem.depthFunc(515); RenderSystem.disableDepthTest(); }
  3. Got it. Thanks a ton!
  4. Hi there! I am currently trying to create a feature where an event is triggered when the player drops an item, and I want to stop the player from dropping it if a boolean is set to true. What event can I use to do this? I've looked at other events and I can't seem to find one that isn't deprecated. A few that I've tried are things like onItemToss, onPlayerDropItem, and onPlayerDestroyItem, but they all appear to be deprecated and not functional. With this in mind, what other event is out there that could work for my project? Thank you!!
×
×
  • Create New...

Important Information

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