December 20, 201311 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, 201311 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, 201311 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, 201311 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.