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]Sending generic entity data that contorls rendering to client side

Featured Replies

Posted

Hello, I am making a mod were I have a block that scans an entity and copies its entity data. Then it uses the entities id to render it on the client side. The problem that I have been experiencing is that I want this to be generic so it would work with entities in other mods, but I'm not sure if there is a generic way to transfer nbt that controls the render of a entity. For example, a sheep, I believe uses nbt to determine what color it is going to render. I know I could hard code that in, but I want to see if there are other option before I do something like this. All help is appreciated, Thank You!

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

  • Author

Sorry for the big delay, but is nbt accessible from the client side?

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

You can use DataWatcher then write method do return your datawatcher data and use it ex. in render class

  • Author

Again sorry for the delay, but is there some good ways to get the variable or keys that mod authors use for their entities in their mods. I can manage the sending to the client part, but I don't know how to specific variables to send across. For example, say that a mod adds a entity that is a random color and that color is stored in the nbt data or somthing like that, how would I be able to got that variable generically, without hardcodeing it in. I would like my mod to work with any mod that it installed with, as long as they don't setup their entities weird.

 

Also I would like to know if the method bellow would work for spawning an entity that is part of a mod, if not then could someone tell me a way that could work.

 

Method:

EntityLiving entityLiving = (EntityLiving) EntityList.createEntityByName(this.getEntityData().getString("id"), this.worldObj);

 

Basibally I have a variable that has an entities nbt data stored and in that nbt, there is a key that is labled id, that is the id of the entity. That variable comes from this method: EntityList.getEntityString();

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

  • Author

How would I send the entire nbt of the entity? Is there a special way to do I need to Iterate over it  somehow.

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

  • Author

Sorry I should have been more specific, I meant actually sending the nbt data, but never mind that because I was being a derp and didn't see that ByteBufUtils has a writeTag method. Going to see if it works now.

Don't be afraid to ask question when modding, there are no stupid question! Unless you don't know java then all your questions are stupid!

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.