Posted September 13, 201510 yr So I have quite a weird situation as far as I can see - the positions of items around my circle are mirrored to where they should be, so when you select one thing you actually get the result above/below what you selected. Hopefully this is clearer with the pictures below: The first image shows how each item is switched (note the ones at the end i.e stick and emerald are in the correct places) and the second shows the order in which they should be in. Here is the rendering code: double radiansPerSector = 2 * Math.PI / sectors; double offset = 0; if (inventoryContents.length % 2 == 0) offset += radiansPerSector / 2; for(int i = 0; i < inventoryContents.length; i++) // Draw icons { double radians = offset + radiansPerSector * i - Math.PI / 2; double itemX = this.ITEM_RADIUS * Math.cos(radians) + centreX - 8; // 8 = offset for texture centre double itemY = this.ITEM_RADIUS * Math.sin(radians) + centreY - 8; // TODO Switch 8 for constant this.renderItemIntoGUI(minecraft.fontRenderer, minecraft.getTextureManager(), inventoryContents[i], itemX, itemY, true); } If you need to see anything else, I'll stick it on. Any help is appreciated. I have no idea what I'm doing.
September 13, 201510 yr Author After fiddling around with many combinations of numbers, I've managed to get it to work. I've changed the offset and radians algorithms. double radiansPerSector = 2 * Math.PI / sectors; double offset = 0 - Math.PI / 2; if (inventoryContents.length % 2 == 0) offset = 0 - Math.PI / 2 + radiansPerSector / 2; for(int i = 0; i < inventoryContents.length; i++) // Draw icons { double radians = 0 - (offset + radiansPerSector * i); double itemX = this.ITEM_RADIUS * Math.cos(radians) + centreX - 8; // 8 = offset for texture centre double itemY = this.ITEM_RADIUS * Math.sin(radians) + centreY - 8; // TODO Switch 8 for constant this.renderItemIntoGUI(minecraft.fontRenderer, minecraft.getTextureManager(), inventoryContents[i], itemX, itemY, true); } I have no idea what I'm doing.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.