Okay, one question: If I use onBlockAdded() in my custom block's class, will it only be called when I add my custom block, or will it be called everytime I add any block?
Edit: I checked it with system message - it only activates when I add the custom block. Problem solved
This is my code for the custom block so far:
package com.monsterBlocker;
import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.world.World;
public class MBBlock extends Block
{
// A list of all MBBlocks and their location
public List mbBlockList = new ArrayList();
public MBBlock (int id)
{
super(id, Material.iron);
this.setUnlocalizedName(MonsterBlocker.mbBlock_unlocalizedName);
this.setCreativeTab(CreativeTabs.tabBlock);
this.setHardness(5F);
this.setResistance(15F);
this.setStepSound(Block.soundMetalFootstep);
this.setLightValue(2F);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister icon) {
blockIcon = icon.registerIcon(MonsterBlocker.AID + ":" + "monsterBlocker");
}
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
//CustomWorldData data = CustomWorldData.get(world);
//data.addBlock(x, y, z);
Position pos = new Position(x, y, z);
mbBlockList.add(pos);
}
}