Jump to content

Recommended Posts

Posted

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?

Posted

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.

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.