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

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:

  1. JSON: Minecraft model
  2. Java: minecfraft Mod Entity model
  3. OBJ: Wavefront obj model

 

I figure that I need to do the following.

  1. Export it as a JAVA
  2. Rename it to the existing ModelMeteor, which extends ModelBase.  
    1. 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);
          }
       
      }

       

  3. Update RenderMeteor somehow to bind to the new model.
    1. 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);
              }
      
          }
      
      }

       

  4. ModelManager will likely stay the same
    1. public class ModelManager {
          public static Map<String, ModelBase> models = new HashMap<String, ModelBase>();
          public static void init(){
              models.put("meteor",new ModelMeteor());
          }
      }

       

  5. I'm also assuming my EntityRegistration will also stay the same?
    1. ResourceLocation meteorRL = new ResourceLocation(MeteorsMod.MODID + ":falling_meteor");
              EntityRegistry.registerModEntity(meteorRL, EntityMeteor.class, "falling_meteor", entityId++, MeteorsMod.instance, 256, 1, true);

       

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

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.