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

Items in my mod will designed by the player similar to tinkers but much more fine grained, to the point that a sword could be shaped like a bucket if that is how it was designed. I've got a pretty good idea of how to handle the properties of the item but frankly I suck at graphics.

 

Is it feasible to render an item based on it's NBT and if so how would I attach the renderer to the item.

 

This is what I had in mind for rendering an item:

public class ItemRenderer {

private static final int PARTDIM = 8;

public void RenderItem(IDraftable draft){
	IPartType[][][] parts = draft.GetPartArray();
                int depth = draft.GetPartsDeep() * PARTDIM;
	int width = draft.GetPartsWide() * PARTDIM;
	int height = draft.GetPartsHigh() * PARTDIM;
	for(int i = 0; i < width; i++)//y position
		for(int j = 0; j < height; j++)//x position
			for(int k = 0; k < depth; k++)//z position
				parts[i][j][[k].GetRenderer().RenderPart(i,j,k);// render piece in location, pieces are partially transparent
}
}

 

my items implement IDraftable and each IPartType implementation has an associated IPartRenderer implementation.

 

Edit: I'm sure that the location won't be as simple as integers but is the underlying idea feasible?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

You'll want to look at

ISmartItemModel

to create a model based on the NBT. I can't help you with it myself, but it's been discussed in various threads on this forum.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.