package xyz.ibatv.iba_backblocks.blocks.mc18;

import cpw.mods.fml.common.registry.EntityRegistry;
import net.minecraft.entity.EntityList;
import xyz.ibatv.iba_backblocks.IBA_BackBlocks;

import java.util.Random;

public class EntityHandler {
    public static void registerEntities(Class entityClass, String name) {
        int entityId = EntityRegistry.findGlobalUniqueEntityId();
        long x =  name.hashCode();
        Random random = new Random(x);
        int mainColor = random.nextInt() * 16777215;
        int subColor = random.nextInt() * 16777215;

        EntityRegistry.registerGlobalEntityID(entityClass, name, entityId);
        EntityRegistry.registerModEntity(entityClass, name, entityId, IBA_BackBlocks.instance, 64, 1, true);
        EntityList.entityEggs.put(Integer.valueOf(entityId), new EntityList.EntityEggInfo(entityId, mainColor, subColor));
    }
}
