Jump to content

Recommended Posts

Posted

Hi, I want to animate a mob texture that I have, but I can't get it working using the .mcmeta file. I am not sure if I am doing it wrong or it has changed. Here is my file file:

 

{

"animation": {

"frames" [0,1]

}}

 

The name of the file is the same as my texture, but my texture is for a custom mob model so I was wondering if it was anything to do with specifying the texture size within the model class.

Posted

A custom mod will have a model class and also a renderer class.  The renderer class is the one that associates the textures to the model.  I think you would do your texture animation there.  You probably don't even have to use meta data, but can control the change in texture any way you wish (use counter to cycle through), or use some state variable (for example wolf entities change the texture to blue eyes when isTamed() is true).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

Okay, I think I implemented something like you said, but it doesn't seem to change the texture and I am not sure if it is a programming error or I am missing something.

 

@SideOnly(Side.CLIENT)
public class RenderEntityGuardianStoneInfusedLava extends RenderLiving
{
private static ResourceLocation textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_0.png");
    private static final String __OBFID = "CL_00000984";

    public void textureAnimation() {
    	
    	int i;
    	
    	i = 0;
    	
    	if(i == 0) {

    		textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_0.png");
    		i++;

    	}
    	
    	if(i == 1) {
    		
    		textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_1.png");
    		i++;
    		
        }
    	
    	if(i == 2) {
    		
    		textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_2.png");
    		i++;
    		
        }
    	
    	if(i == 3) {
    		
    		textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_3.png");
    		i++;
    		
        }
    	
    	if(i == 4) {
    		
    		textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_4.png");
    		i++;
    		
    	}
    	
    	if(i == 5) {
    		
    		textures = new ResourceLocation(LivingBlocks.MODID + ":" + "textures/entity/livingblocks/entity_guardian_stone_infused_lava_5.png");
    		i = 0;
    		
        }

    	System.out.println(i);
    	
    }
    
    public RenderEntityGuardianStoneInfusedLava(ModelBase par1ModelBase, float par2)
    {
        super(par1ModelBase, par2);

    }

    protected ResourceLocation getEntityTexture(EntityGuardianStoneInfusedLava par1EntityGuardianStoneInfusedLava)
    {
    	textureAnimation();
    	
        return textures;
    }

    protected ResourceLocation getEntityTexture(Entity par1Entity)
    {
        return this.getEntityTexture((EntityGuardianStoneInfusedLava)par1Entity);
    }
}

Posted

Make sure your metamc file is not a txt file. When you go to properties it should NOT tell you txt. Even if you save it properly, it will still convert it to txt, so be sure to go back and convert it yourself.

 

Other than that, I believe animations require 32 frames, but I might be wrong. Beyond that, I think the code is only pulling a texture, but won't update a texture. Consider using another Event to control it/tick it and see how far you get there.

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.