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.

[1.7.10][Solved] Rendering items on HUD positions horizontally mirrored

Featured Replies

Posted

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:

ENi7a7x.png

Gh07klU.png

 

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.

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.