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.

Featured Replies

Posted

Hey guys, after much frustration and fruitless searching I come in search of the wisdom of those who have come before me.

 

I am attempting to replicate the functionality of the vanilla compass. My compass would point to the player's last death. I already have the player spawn with the "Grave Compass" item, nbt data included for the BlockPos. I'm running into a wall when it comes to updating the texture in real time. I attempted to look at the rendering code for the vanilla compass only to realize that it is hard coded. My latest effort was to use ModelLoader.setCustomMeshDefinition however that would limit me to only the information provided in the item stack. What classes should I be looking at to enable me to update the item's texture in a similar manner to its vanilla counterpart.

 

Thanks.

Have you looked in the TextureCompass class? (net.minecraft.client.renderer.texture.TextureCompass) It looks promising. It contains an updateCompass function which you pass in coords to where you want the compass to point to.

Did I help you? Don't be afraid to give that 'thank you' button a good smack for me!

It's been looking at me weirdly for a while now.

That is in fact where you should look.  The method used has a whole ton of parameters you can exploit to get all kinds of information.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author

I have looked into TextureCompass. Implementing it would be no issue for me. What I can't seem to figure out is how to register my "TextureCompass" class. Vanilla's is hard coded in RenderItemFrame to check if the the item being rendered is the vanilla compass. Same story in TextureAtlasSprite.makeAtlasSprite()

  • Author

Update:

 

I've registered my subclass of TextureCompass during preinit on the client side via the TextureStitchEvent.Pre event.

I'm using the TextureMap.setTextureEntry() function and the resource location of my texture.

  • Author

At this point, it is running my TextureGraveCompass.updateCompass(). I'm just passing it along to the super.updateCompass() at the moment. However it is still giving me the missing texture.

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.