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

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.

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/

  • Author

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);
    }
}

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

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.