Jump to content

Recommended Posts

Posted

I've been looking at examples and reading any tutorials I can find but it's just not clicking for me.

 

I am trying to generate an ItemModel from nbt. I have a set of parts, each part has information about its location(relative to a 16x16x16 cube), it's RGBA and eventually its quad once I figure out how this works. I am trying to stitch this information together to create the model.

 

I am unsure what other information would be need to for someone to actually help, so I will either provide whatever people ask for or do my best implement what I am missing and then bring it back here.

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

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

Posted

Ok, so right now I have a registry of all available Draftable items that gets maintained server side and a client side registry that gets updated by the server. So I will probably want to generate my model for each Draftable when it gets updated from the server.

 

public DraftableSmartItemModel implements ISmartItemModel{

   @Override
   public IFlexibleBakedModel handleItemState(ItemStack stack) {
      IFlexibleBakedModel model = null;
      if(stack.getTagCompound().hasKey(Refs.DRAFTABLE) && stack.model == null)
         model = DraftableReg.GetModel(stack.getTagCompound().getString(Refs.DRAFTABLE));
      return model;
   }

}

 

I assume that this is not unique per ItemStack, meaning that I would have to do it this way and not have model as a private class variable.

 

Next part:

From what I can tell I will still need to used BakedQuads for my model. So I looked into BakedQuads and FaceBakery for the vertex information, but what is happing with shadecolor and is this where I would store my RGBA information?

This is what is getting stored in shade color from FaceBakery, which appears to be a range of magenta - blue but I really don't know what is going on in that return. I recognize the shift left but thats it.

private int getFaceShadeColor(EnumFacing facing)
    {
        float f = this.getFaceBrightness(facing);
        int i = MathHelper.clamp_int((int)(f * 255.0F), 0, 255);
        return -16777216 | i << 16 | i << 8 | i;
    }

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

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

Posted

I am planning something like this:

DraftableBakedModel implements IFlexibleBakedModel{

   private List<BakedQuad> quads = new ArrayList<BakedQuad>();

   public DraftableBakedModel(IDraftable draft){
      HashMap<String, IPartType> parts = draft.getParts();
      for(int i = x; x < 16; x++)
         for(int y = 0; y < 16; y++)
            for(int z = 0; z < 16; z++)
               if(parts.contain(x + "," + y + "," z))
                  quads.addAll(getQuadFrom(parts.get(x + "," + y + "," z), x, y, z);

   }

   //x, y, z specify the relative top, left, front, for the part to base it's vertices from.
   private List<BakedQuad> getQuadFrom(IPartType part,int x, int y, int z){
      // part has relative vertex information and RGBA for the color and transparency
      // that this part should render with.
      // each part can be thought of as a semi transparent, single color cube
      // although they may not actually be cubes
   }
   
}

 

1. is this the correct place to be specifying a color to render with?

2. it seems like each vertex of Baked Quad only has 1 variable for color, so how do I store the color?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.