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

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?

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

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.

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.