Jump to content

[1.7.2]Rendering a projectile


Hackbaellchen

Recommended Posts

Good work there! Thank you! :)

Another question: Do you know how to create the render without having an item (just the texture) ?

You will have to use the Tessellator to draw it, like vanilla does when rendering an IIcon texture. Another option is to use a model and let the model renderer do the work for you.

 

While the 1.7.2 code for my mod isn't up yet (dang GitHub), the rendering code hasn't changed all that much from 1.6.4, and I've got plenty of projectile entities that you could look at for inspiration:

https://github.com/coolAlias/ZeldaSwordSkills

 

If I want to add one more projectile it is always rendered as the previously..

Make sure you're not using "static" for things in your render or entity. That's the best advice I can give without seeing any code.

Link to comment
Share on other sites

Yes, but the problem is that my next projectile is rendered as this one before..

 

EntityRegistry.registerModEntity(EntityMyItem.class, "MyItem", EntityRegistry.findGlobalUniqueEntityId(), this, 64, 10, true);
EntityRegistry.registerModEntity(EntityMySecondItem.class, "MySecondItem", EntityRegistry.findGlobalUniqueEntityId(), this, 64, 10, true);

RenderingRegistry.registerEntityRenderingHandler(EntityMyItem.class, new RenderSnowball(Items.egg));
RenderingRegistry.registerEntityRenderingHandler(EntityMySecondItem.class, new RenderSnowball(Items.fire_charge));    

Link to comment
Share on other sites

Don't use "EntityRegistry.findGlobalUniqueEntityId()" with registerModEntity - that's completely different. What I do is create a local "int entityIndex = 0" and use that as "entityIndex++" for the id of each mod entity.

 

int entityIndex = 0;
EntityRegistry.registerModEntity(EntityMyItem.class, "MyItem", entityIndex++, this, 64, 10, true);
EntityRegistry.registerModEntity(EntityMySecondItem.class, "MySecondItem", entityIndex++, this, 64, 10, true);

Link to comment
Share on other sites

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.