Posted March 12, 20178 yr I can find tutorials for using obj models for items and blocks, but not for entities. Can you use obj models for entities? I'm pretty much stuck at creating the Render class for the entity. Here is what I have so far: Spoiler public class RenderSpellProjectile extends Render<EntitySpellProjectile> { private ResourceLocation texture = new ResourceLocation(Reference.MODID, "textures/entity/spell_projectile.png"); private ResourceLocation obj = new ResourceLocation(Reference.MODID, "models/obj/sphere/sphere.obj"); //private ModelBase model1; private IModel model2; public static final RenderFactory FACTORY = new RenderFactory(); public RenderSpellProjectile(RenderManager renderManager) { super(renderManager); //model1 = new ModelSpellProjectile(); try { model2 = OBJLoader.INSTANCE.loadModel(obj); } catch (Exception e) { System.out.println("Unable to load sphere.obj"); } } @Override protected ResourceLocation getEntityTexture(EntitySpellProjectile entity) { return texture; } @Override public void doRender(EntitySpellProjectile entity, double x, double y, double z, float entityYaw, float partialTicks) { // Render for model1 /* GL11.glPushMatrix(); bindTexture(texture); GL11.glTranslated(x, y - 1.25D, z); model1.render(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); */ // Render for model2 } public boolean shouldRender(EntitySpellProjectile livingEntity, ICamera camera, double camX, double camY, double camZ) { return true; } public static class RenderFactory implements IRenderFactory<EntitySpellProjectile> { @Override public Render<? super EntitySpellProjectile> createRenderFor(RenderManager manager) { return new RenderSpellProjectile(manager); } } } That should load the model, right? If so, how do I render it in doRender()?
March 12, 20178 yr AnimationModelBase is a ModelBase that renders an animated baked model. If the model isn't animated, you can create your own Render/ModelBase and cache the IBakedModel instead of re-baking it each frame. 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.
March 12, 20178 yr Author Welp, looks like this out of my league lol. I'm currently in the process of learning openGL and it looks like I will need openGL to write my own render, So this project will be put on hold. Thanks for the help!
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.