Posted June 18, 20178 yr Does anyone have any good resources on using models created from Cubik for entities? I looked at McJty's tutorial, and I have it rendering using a simple texture, but I would like to move past that and use the model generated from `Cubik`. I noticed it gives the following options for export: JSON: Minecraft model Java: minecfraft Mod Entity model OBJ: Wavefront obj model I figure that I need to do the following. Export it as a JAVA Rename it to the existing ModelMeteor, which extends ModelBase. public class MeteorModel extends ModelBase { //fields ModelRenderer e1; ModelRenderer e2; ModelRenderer e3; ModelRenderer e4; ModelRenderer e5; ModelRenderer e6; public CubikModel() { textureWidth = 64; textureHeight = 64; e1 = new ModelRenderer(this, 0, 55); e1.addBox(3F, 7F, 3.5F, 11, 1, 8); e1.setRotationPoint(3F, 7F, 3.5F); e1.setTextureSize(64, 64); e1.mirror = false; setRotation(e1, 0F, 0F, 0F); e2 = new ModelRenderer(this, 0, 48); e2.addBox(4F, 5F, 4.5F, 9, 1, 6); e2.setRotationPoint(4F, 5F, 4.5F); e2.setTextureSize(64, 64); e2.mirror = false; setRotation(e2, 0F, 0F, 0F); e3 = new ModelRenderer(this, 0, 48); e3.addBox(4F, 8F, 4.5F, 9, 1, 6); e3.setRotationPoint(4F, 8F, 4.5F); e3.setTextureSize(64, 64); e3.mirror = false; setRotation(e3, 0F, 0F, 0F); e4 = new ModelRenderer(this, 38, 58); e4.addBox(5.5F, 4F, 5F, 6, 1, 5); e4.setRotationPoint(5.5F, 4F, 5F); e4.setTextureSize(64, 64); e4.mirror = false; setRotation(e4, 0F, 0F, 0F); e5 = new ModelRenderer(this, 38, 58); e5.addBox(5.5F, 9F, 5F, 6, 1, 5); e5.setRotationPoint(5.5F, 9F, 5F); e5.setTextureSize(64, 64); e5.mirror = false; setRotation(e5, 0F, 0F, 0F); e6 = new ModelRenderer(this, 0, 55); e6.addBox(3F, 6F, 3.5F, 11, 1, 8); e6.setRotationPoint(3F, 6F, 3.5F); e6.setTextureSize(64, 64); e6.mirror = false; setRotation(e6, 0F, 0F, 0F); } public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5, entity); e1.render(f5); e2.render(f5); e3.render(f5); e4.render(f5); e5.render(f5); e6.render(f5); } private void setRotation(ModelRenderer model, float x, float y, float z) { model.rotateAngleX = x; model.rotateAngleY = y; model.rotateAngleZ = z; } public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity) { super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); } } Update RenderMeteor somehow to bind to the new model. public class RenderMeteor extends Render<EntityMeteor> { private ModelMeteor modelMeteor = new ModelMeteor(); private ResourceLocation meteorTexture = new ResourceLocation(MeteorsMod.MODID, "textures/entity/fallingmeteor.png"); public RenderMeteor(RenderManager renderManager, ModelBase model, float shadow) { super(renderManager); this.modelMeteor = new ModelMeteor(); this.shadowSize = shadow; } @Override public void doRender(EntityMeteor entity, double d, double d1, double d2, float f, float f1) { renderMeteor(entity, d, d1, d2, f, f1); } public void renderMeteor(EntityMeteor entityMeteor, double d, double d1, double d2, float f, float f1) { GL11.glPushMatrix(); GL11.glTranslatef((float)d, (float)d1, (float)d2); GL11.glRotatef(entityMeteor.prevRotationYaw + (entityMeteor.rotationYaw - entityMeteor.prevRotationYaw) * f1, 0.0F, 1.0F, 0.0F); GL11.glRotatef(entityMeteor.prevRotationPitch + (entityMeteor.rotationPitch - entityMeteor.prevRotationPitch) * f1, 0.0F, 0.0F, 1.0F); this.bindTexture(meteorTexture); float f2 = 1.0F * (float)entityMeteor.size; GL11.glScalef(f2, f2, f2); modelMeteor.renderWithSize(entityMeteor.size, 0.0625F); GL11.glPopMatrix(); } @Override public boolean canRenderName(EntityMeteor entity){ return false; } @Override protected ResourceLocation getEntityTexture(EntityMeteor entity) { return meteorTexture; } public static class Factory implements IRenderFactory<EntityMeteor> { @Override public Render<? super EntityMeteor> createRenderFor(RenderManager manager) { return new RenderMeteor(manager, ModelManager.models.get("meteor"), 0.5f); } } } ModelManager will likely stay the same public class ModelManager { public static Map<String, ModelBase> models = new HashMap<String, ModelBase>(); public static void init(){ models.put("meteor",new ModelMeteor()); } } I'm also assuming my EntityRegistration will also stay the same? ResourceLocation meteorRL = new ResourceLocation(MeteorsMod.MODID + ":falling_meteor"); EntityRegistry.registerModEntity(meteorRL, EntityMeteor.class, "falling_meteor", entityId++, MeteorsMod.instance, 256, 1, true); And then I need to put the entity model json inside the resources/assets/meteors/models/entity folder? But after trying the above, I'm still not getting it to render properly.. so any resources would be most appreciated.
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.