Posted June 2, 201411 yr I been trying to figure out how to do blocks with metadata, and I've found some tutorials on how to do it, but they seem to be slightly dated to work with 1.7. Is there a good place you can point me at to learn properly for 1.7?
June 2, 201411 yr Author Here is what I have so far package com.bigbaddevil7.rustic.blocks; import java.util.List; import java.util.Random; import javax.swing.Icon; import com.bigbaddevil7.rustic.Rustic; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockBreakable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; public class DecorGlass extends BlockBreakable{ public DecorGlass(String p_i45411_1_, Material p_i45411_2_, boolean p_i45411_3_) { super(p_i45411_1_, p_i45411_2_, p_i45411_3_); } public int quantityDropped(Random par1Random){ return 1; } @SideOnly(Side.CLIENT) public int getRenderBlockPass(){ return 0; } public boolean isOpaqueCube(){ return false; } public boolean renderAsNormalBlock(){ return false; } @SideOnly(Side.CLIENT) private Icon[] icons; @SideOnly(Side.CLIENT) public void regiserIcons(IIconRegister par1IconRegister){ icons = new Icon[8]; for(int i = 0; i < icons.length; i++){ icons[i] = (Icon)par1IconRegister.registerIcon(Rustic.MODID + ":" + "decorglass" + i); } } @SideOnly(Side.CLIENT) public IIcon getIcon(int par1, int par2){ return (IIcon) icons[par2]; } @SideOnly(Side.CLIENT) public void getsubBlocks(Block par1, CreativeTabs tabs, List list){ for(int i = 0; i < icons.length; i++){ list.add(new ItemStack(par1, 1, i)); } } } I have the problem with receiving a null pointer during the getIcon method. I trying to take old tutorials and make them usable for 1.7, but as you will most likely tell, I didn't do something right. What is it that I'm missing during this process here.
June 2, 201411 yr Icon in 1.6 -> IIcon in 1.7.2. Such change. Wow. Metadata didn't change at all from 1.6. Thus the tutorial is still valid.
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.