Jump to content

Roboguy99

Members
  • Posts

    230
  • Joined

  • Last visited

Everything posted by Roboguy99

  1. That's fixed it, thanks! We'll ignore the part where after doing what you said, I spent ages trying to fix the keybinding not working because I forgot I rebound the key.
  2. Bump. This is still broken and I'm not sure why. The code is being run, but nothing appears on the screen. Here is the code, as far as I can see the same as when it was mostly working. public class EventsHandler extends Gui { private static final int RADIUS = 90; private static final int SECTORS = 200; @SideOnly(Side.CLIENT) @SubscribeEvent(priority = EventPriority.NORMAL) public void onRenderExperienceBar(RenderGameOverlayEvent.Post event) { Item holding; if (Minecraft.getMinecraft().thePlayer.getHeldItem() != null) { if (event.type == ElementType.ALL) { holding = Minecraft.getMinecraft().thePlayer.getHeldItem().getItem(); if (holding instanceof ItemBag && HotbarBag.bagHUD.getIsKeyPressed()) { BagInventory inventory = new BagInventory(Minecraft.getMinecraft().thePlayer.getHeldItem()); int items = 0; for(int i = 0; i < inventory.getSizeInventory(); i++) { if (inventory.getStackInSlot(i) != null) items++; } int x = event.resolution.getScaledWidth() / 2; int y = event.resolution.getScaledHeight() / 2 - 15; if (items != 0) { float multiplier = this.SECTORS / items; GL11.glPushMatrix(); GL11.glColor4f(0.6F, 0.6F, 0.6F, 0.3F); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex2f(x, y); for(int i = 0; i < items; i++) { for(float n = 0 + (i * multiplier); n <= (this.SECTORS / items) + (i * multiplier); n += 1) { double t = 2 * Math.PI * (float) n / (float) this.SECTORS; GL11.glVertex2d(x + Math.sin(t) * this.RADIUS, y + Math.cos(t) * this.RADIUS); } } GL11.glEnd(); // ItemStack itemStack = inventory.getStackInSlot(1); // EntityItem entity = new // EntityItem(Minecraft.getMinecraft().theWorld, 0, 0, // 0, itemStack); GL11.glPopMatrix(); float mouseX = Mouse.getX(); float mouseY = Mouse.getY(); } } } } } }
  3. For some odd reason it still stops/starts drawing as you change orientation. For some reason it seems to only work if you look south or east. EDIT: It's not working at all now. I have changed nothing and the code is still being executed, but nothing is being drawn.
  4. Alright thanks I will look into that. I'm surprised I didn't see that myself to be honest. I'm making the mod for 1.7.10 so I can use it with existing modpacks. I plan on making a 1.8 version straight after.
  5. I actually have some code to render items using 3D models (made in Techne or Tabula) in the inventory - could this somehow be manipulated to use the standard models instead of custom ones?
  6. Ok at this point I'm just going to show you what I've done so far and hopefully you'll be able to help me better. Pressing the keybinding while holding the item brings up a 100% opaque circle in the middle of the screen, which occasionally changes from black to very dark brown when I change direction - it appears to be ignoring the Color4f line altogether. EDIT: I have changed the class to extend Gui and checked to render after the experience bar. I now get the desired semi-transparent circle, but if I turn around it sometimes disappears. Here is the updated code: What I want is a semi-transparent grey circle. I assume it's just a few minor OpenGL things I'm not sure about causing this.
  7. Where can I find this? All I've found is the github page which is still very much obfuscated, and there is no class under this name I can import. I probably should have said, this is for 1.7.10. net.minecraft.client.renderer.entity.RenderEntityItem.class probably is the same for 1.7... idk.. It's not there, I think they added it in 1.8 when a lot of the rendering code changed. Is there another way of doing what I want to do, or can I write the class myself (or could somebody with the class upload it is even possible to implement into a mod)?
  8. Where can I find this? All I've found is the github page which is still very much obfuscated, and there is no class under this name I can import. I probably should have said, this is for 1.7.10.
  9. Is it possible to render an item on the HUD as if it had been dropped on the ground? If so, how would I go about doing that?
  10. Ok that makes sense. In terms of RenderGameOverlayEvent with a brand new HUD element, how would I implement that and what subevent should I use?
  11. How do I choose a subevent? My knowledge on Forge events is pretty limited.
  12. Did you register your event handler? I have this line in my main class: FMLCommonHandler.instance().bus().register(new EventsHandler()); Is that correct? I've tried loading it at pre and post init stages with nothing happening.
  13. I'm going to need more help with this, my RenderGameOverlayEvent appears to be doing nothing (perhaps I needed to specify something extra?). Here is the code: @SubscribeEvent(priority = EventPriority.NORMAL) public void renderOverlay(RenderGameOverlayEvent event) { System.out.println("fghgh"); int x = Minecraft.getMinecraft().displayWidth/2; int y = Minecraft.getMinecraft().displayHeight/2; int r = 200; GL11.glBegin( GL11.GL_TRIANGLE_FAN ); GL11.glVertex2f(x, y); for( int n = 0; n <= 18; n++ ) { float t = 2 * 3.14152f * (float)n / (float)18; GL11.glVertex2d(x + Math.sin(t) * r, y + Math.cos(t) * r); } GL11.glRectd(x, y, x+100, y+200); GL11.glEnd(); }
  14. My question is firstly, how do I draw to the HUD and secondly, how can I only do this when a key is held down (I have a keyevent already set up). Is it possible to do it using OpenGL directly or is there something else I should use?
  15. Derp, forgot to change a couple of things when copy/pasting larger bits of code from your tutorial (thanks for that, by the way - very useful). I have removed the open/close code after testing it and finding it does nothing. Thanks.
  16. I have implemented a keybinding that works into my mod, however I want to get the entityPlayer that pressed the key. How would I go about doing this?
  17. Haha that's the tutorial I've followed to get as far as I have. For some reason the NBT is not working though. I'll have a look again. Anybody who does know what's gone wrong, an answer is still greatly appreciated.
  18. I have. I don't mean to be rude, but have you actually looked at my code?
  19. My class does not extend any class and the IInventory interface does not include these methods. There is no such thing.
  20. I have made an item with its own inventory, and so far the GUI opens with its own slots correctly when you right click and you can put items in the slots. If you close the inventory and re-open it, all the items are gone. I know this is an NBT issue, and I've had numerous problems with NBT before (probably just me). Here is my inventory code: If you need to see any other code, I will upload it. Any help is greatly appreciated.
  21. My recipe remover mod (all the code can be found here: https://github.com/Roboguy99/Recipe-Remover) is causing strange recipe-related effects to occur. For whatever reason, any recipe (vanilla and some modded recipes) which would normally return an ItemStack of greater than 1 when crafted (e.g. 1 oak wood log -> 4 oak wooden planks) only return 1 whenever my mod is installed. If anybody could take the time to see if there is anything obvious in my code. Apart from two command classes here is all of the code: The code for the commands can be seen on the github link above. Thanks.
  22. As my title suggests, I want my mod to be installed on a server without requiring it client-side. How can I do this?
  23. So I'm making a small mod which is supposed to remove the recipes of items you put in a config file. My code for actually removing the recipes is not working. The first two if statements are called correctly, but the final one never is. It seems that recipeResult is given the same list of fairly random items Code: I've also included my log (I used the print method from my other mod and printed out recipeResult at the bottom of the loop): As I said before, these items are always exactly the same ones. They are not the order they appear in the crafting manager and it's nothing to do with their IDs Any help is appreciated and thanks in advance.
×
×
  • Create New...

Important Information

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