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

the block ID has to be below 256 to use it as a top or filler block.  This may change in the next version I think without block IDs but for now that's your issue. 

  • Author

There is block class

Learn java.

You construct your Biome (

new

is the keyword to construct a new instance) before you construct the Block. But then in your Biome constructor you refer to the Block instance (which doesn't exist yet, it's null. That causes a NPE).

 

look:

 

BlockClass redstone:

 

public class BlockRedStone extends Block{
    public BlockRedStone(int blockID)
    {
    	super(blockID, Material.rock);
    	this.setCreativeTab(mod_SecretMod.tabSecretMod);
    	setHardness(4.0f);
    	setResistance(4.0f);
    	setStepSound(soundStoneFootstep);
    }

    @Override
    public void registerIcons(IconRegister iconRegister)
    {
            blockIcon = iconRegister.registerIcon("secretmod:RedStone");
    }

}

 

blockclass red grass:

 

public class BlockRedGrass extends Block{
protected Icon[] textures = new Icon[3];
    public BlockRedGrass(int blockID)
    {
    	super(blockID, Material.ground);
    	this.setCreativeTab(mod_SecretMod.tabSecretMod);
    	setHardness(4.0f);
    	setResistance(6.0f);
    	setStepSound(soundStoneFootstep);
    }
    
    public boolean isOpaqueCube()
    {
    	return false;
    }
    public boolean renderAsNormalBlock()
    {
    	return false;   	
    }
    public int getRenderBlockPass()
    {
    	return 1;
    }
    @Override
    public void registerIcons(IconRegister iconRegister)
    {
    	textures[0] = iconRegister.registerIcon("secretmod:grass_side");
    	textures[1] = iconRegister.registerIcon("secretmod:grass_top");
    	textures[2] = iconRegister.registerIcon("secretmod:dirt");
           
    }
    
    @Override
    public Icon getIcon(int side, int meta)
    {
    	if(side==0){
    		return textures[2];
    	} else if (side==1){
    		return textures[1];
    	} else if (side==2){
    		return textures[0];
    	} else if (side==3){
    		return textures[0];
    	} else if (side==4){
    		return textures[0];
    	} else if (side==5){
    		return textures[0];
    	} else {
    		return textures[0];
    	}
    }
}

  • Author

Argh.

myBiome = new MyBiomeClass();
myBlock = new MyBlock();

That is what you have. Inside the MyBiomeClass constructor you have a reference to the myBlock field, which is still null at that point. Java executes your code from top to bottom.

 

I fix it, but when i create new world the biome is all iron ore

  • Author

I fix it, but when i create new world the biome is all iron ore

the block ID has to be below 256 to use it as a top or filler block.  This may change in the next version I think without block IDs but for now that's your issue.

 

how to solve this? because I want to make the biome with a custom block

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.