December 20, 201312 yr 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.ย
December 21, 201312 yr 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]; ย ย } ย ย } }
December 21, 201312 yr 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
December 22, 201312 yr 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.