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

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.

  • Author

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;

}

}

 

 

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.

  • Author

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

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.