Jump to content

Recommended Posts

Posted

Question here, does it now call the updateAnimation method?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

I do not think it does.

BlockNullOre:

 

 

package aj.Java.Nullvoid.block;

 

import java.util.Random;

 

import aj.Java.Nullvoid.VoidMod;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.item.Item;

import net.minecraft.world.World;

 

public class BlockNullOre extends Block {

public BlockNullOre() {

super(Material.iron);

setCreativeTab(VoidMod.ctab);

setTickRandomly(true);

setHardness(15F);

setBlockTextureName("nullvoid:nullOre");

}

public int tickRate(World p_149738_1_)

    {

        return 10;

    }

public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)

    {

        return VoidMod.ingotNull;

    }

     

@SideOnly(Side.CLIENT)

@Override

public void registerBlockIcons(IIconRegister par1IconRegister)

{

this.blockIcon = VoidMod.texNullOre;

}

}

 

 

TextureNullOre:

 

 

package aj.Java.Nullvoid.client.render;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import aj.Java.Nullvoid.VoidMod;

import net.minecraft.client.Minecraft;

import net.minecraft.client.entity.EntityClientPlayerMP;

import net.minecraft.client.renderer.texture.TextureAtlasSprite;

import net.minecraft.client.renderer.texture.TextureUtil;

import net.minecraft.item.ItemStack;

 

public class TextureNullOre extends TextureAtlasSprite {

 

public TextureNullOre(String par1Str) {

super(par1Str);

}

 

@Override

@SideOnly(Side.CLIENT)

public void updateAnimation() {

System.out.println("updateAnimation");

EntityClientPlayerMP p = Minecraft.getMinecraft().thePlayer;

if (p.inventory.armorInventory[3] != null) {

if (p.inventory.armorInventory[3].isItemEqual(new ItemStack(

VoidMod.nullGoggles))) {

this.frameCounter = getFrameForDim(p.dimension, true);

} else {

this.frameCounter = getFrameForDim(p.dimension, false);

}

} else {

this.frameCounter = getFrameForDim(p.dimension, false);

}

TextureUtil.uploadTextureMipmap(

(int[][]) this.framesTextureData.get(this.frameCounter),

this.width, this.height, this.originX, this.originY, false,

false);

}

@SideOnly(Side.CLIENT)

private int getFrameForDim(int dim, boolean goggle) {

if (!goggle) {

if (dim == 0) {

return 0;

} else if (dim == -1) {

return 1;

} else if (dim == 1) {

return 2;

} else if (dim == VoidMod.NullVoidDimID) {

return 3;

}

} else {

if (dim == 0) {

return 4;

} else if (dim == -1) {

return 5;

} else if (dim == 1) {

return 6;

} else if (dim == VoidMod.NullVoidDimID) {

return 7;

}

}

return 0;

}

@Override

public boolean hasAnimationMetadata(){

return true;

}

}

 

 

Posted

So you don't see the "updateAnimation" string in your console?

 

I've tried the animation thingy for blocks now and it works for me.

Here's the example code I've made up:

https://gist.github.com/SanAndreasP/06fb4c4ecaa9e1e1e746

 

Maybe you can spot the difference...

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

IT WORKS! It seems like some events require FMLCommonHandler.instance().bus().register while others require MinecraftForge.EVENT_BUS.register. I just registered my TickHandler to both. Thank you!

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.