package net.acomputerdog.BlazeLoader.api.entity;

import net.acomputerdog.BlazeLoader.main.BlazeLoader;
import net.minecraft.entity.EntityList;

/**
 * Api for entity-related functions
 */
public class ApiEntity {

    /**
     * Registers a custom entity type.
     *
     * @param entityClass The entity class to register.
     * @param entityName  The name of the entity to register.
     * @param entityId    The entityId that is used to represent the entity over the network and in saves.
     */
    public static void registerEntityType(Class entityClass, String entityName, int entityId) {
        EntityList.addMapping(entityClass, entityName, entityId);
    }

    /**
     * Registers a spawn egg for a given entity type.
     *
     * @param entityId The entityID for this egg.
     * @param eggInfo  The EntityEggInfo to register.
     */
    public static void registerEntityEggInfo(int entityId, EntityList.EntityEggInfo eggInfo) {
        EntityList.entityEggs.put(entityId, eggInfo);
    }

    /**
     * Gets a free entity ID.
     *
     * @return return a free entity ID.
     */
    public static int getFreeEntityId() {
        while (EntityList.getClassFromID(BlazeLoader.currFreeEntityId) == null) {
            BlazeLoader.currFreeEntityId++;
        }
        int currId = BlazeLoader.currFreeEntityId;
        BlazeLoader.currFreeEntityId++;
        return currId;
    }
}

@@ -97,16 +97,52 @@
 Loader;%0A
+import net.minecraft.entity.Entity;%0A
 import n
@@ -1427,11 +1427,1330 @@
 d;%0A    %7D
+%0A%0A    /**%0A     * Gets the entity ID of the passed entity.%0A     * @param entity The entity to get the ID from%0A     * @return Return the ID of the entity%0A     */%0A    public static int getEntityID(Entity entity) %7B%0A        return EntityList.getEntityID(entity);%0A    %7D%0A%0A    /**%0A     * Gets an entity's class from an entity ID%0A     * @param id The ID of the entity.%0A     * @return Return the class of the passed entity.%0A     */%0A    public static Class getEntityClassFromID(int id) %7B%0A        return EntityList.getClassFromID(id);%0A    %7D%0A%0A    /**%0A     * Gets the type of an entity%0A     * @param entity The entity who's type to get%0A     * @return Return the type of the passed entity.%0A     */%0A    public static String getEntityType(Entity entity) %7B%0A        return EntityList.getEntityString(entity);%0A    %7D%0A%0A    /**%0A     * Gets the type of an entity from it's ID%0A     * @param id The ID of the entity.%0A     * @return Return the type of the entity.%0A     */%0A    public static String getEntityTypeFromID(int id) %7B%0A        return EntityList.getStringFromID(id);%0A    %7D%0A%0A    /**%0A     * Gets an entity ID from a String.%0A     * @param type The string identifying the entity.%0A     * @return Return then ID of the entity.%0A     */%0A    public static int getEntityIDFromType(String type)%7B%0A        return EntityList.getIDFromString(type);%0A    %7D
 %0A%7D%0A

Expand ApiEntity