I wanted to share custom data with the client for my mobs.
I first tried to send a custom packet but then I found this :
http://www.minecraftforge.net/forum/index.php/topic,1410.msg12341.html#msg12341
So I made my Entity implement IEntityAdditionalSpawnData :
/**
* @author Manchou
*
*/
public class EntityDarwinCreature extends EntityAnimal implements IEntityAdditionalSpawnData {
private long genome;
/**
* @param par1World
*/
public EntityDarwinCreature(World world) {
super(world);
this.texture = "/net/darwin/darwinCreature.png";
genome = 0;
}
// specific code
@Override
public void writeSpawnData(ByteArrayDataOutput data) {
data.writeLong(genome);
System.out.println("writeSpawnData "+genome);
}
@Override
public void readSpawnData(ByteArrayDataInput data) {
genome = data.readLong();
System.out.println("readSpawnData "+genome);
}
public void setGenome(long genome) {
this.genome = genome;
}
}
And well, the methods write/readSpawnData() are never called.
I tried to make them spawn with an monsterPlacer and with a spawn rule:
EntityRegistry.addSpawn(EntityDarwinCreature.class, 20, 10, 10, EnumCreatureType.creature,
new BiomeGenBase[]{desert, beach, iceMountains, icePlains, taiga, taigaHills, desertHills, forest, forestHills, plains, extremeHills, extremeHillsEdge, jungle, jungleHills});
The mob spawns but the data is not shared.