net.minecraft.entity.ai.EntityAIBase Java Examples

The following examples show how to use net.minecraft.entity.ai.EntityAIBase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityUtils.java    From enderutilities with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Removes the (last found) dummy blocker AI task, if any
 * @param tasks
 */
public static void removeDummyAIBlockerTask(EntityAITasks tasks)
{
    EntityAIBase task = null;

    for (EntityAITaskEntry taskEntry : tasks.taskEntries)
    {
        if (taskEntry.action instanceof EntityAIDummyBlockerTask)
        {
            task = taskEntry.action;
        }

        // Restore the default mutex bits.
        // TODO: If modded mob tasks use this bit, then we should store the original value so we can restore it.
        if (taskEntry.action instanceof EntityAIFindEntityNearestPlayer)
        {
            taskEntry.action.setMutexBits(taskEntry.action.getMutexBits() & 0x7F);
        }
    }

    if (task != null)
    {
        tasks.removeTask(task);
    }
}
 
Example #2
Source File: ProgWidgetEntityRightClick.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneEntityBase<IProgWidget, EntityLivingBase>(drone, widget){
        private final List<Entity> visitedEntities = new ArrayList<Entity>();

        @Override
        protected boolean isEntityValid(Entity entity){
            return entity instanceof EntityLivingBase && !visitedEntities.contains(entity);
        }

        @Override
        protected boolean doAction(){
            visitedEntities.add(targetedEntity);
            boolean activated = false;
            ItemStack stack = drone.getInventory().getStackInSlot(0);
            if(stack != null && stack.getItem().itemInteractionForEntity(stack, drone.getFakePlayer(), targetedEntity)) {
                activated = true;
            }
            if(!activated && targetedEntity instanceof EntityAgeable && ((EntityAgeable)targetedEntity).interact(drone.getFakePlayer())) {
                activated = true;
            }
            DroneAIBlockInteract.transferToDroneFromFakePlayer(drone);
            return false;//return activated; <-- will right click as long as it's sucessfully activated.
        }

    };
}
 
Example #3
Source File: DroneAIManager.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
/**
 * removes the indicated task from the entity's AI tasks.
 */
public void removeTask(EntityAIBase par1EntityAIBase){
    Iterator iterator = taskEntries.iterator();

    while(iterator.hasNext()) {
        EntityAITaskEntry entityaitaskentry = (EntityAITaskEntry)iterator.next();
        EntityAIBase entityaibase1 = entityaitaskentry.action;

        if(entityaibase1 == par1EntityAIBase) {
            if(executingTaskEntries.contains(entityaitaskentry)) {
                entityaibase1.resetTask();
                executingTaskEntries.remove(entityaitaskentry);
            }

            iterator.remove();
        }
    }
}
 
Example #4
Source File: EntityAITasksWrapper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void removeTask(EntityAIBase ai) {
    original.removeTask(ai);
}
 
Example #5
Source File: ProgWidgetDroneEvaluation.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    if(widget instanceof ProgWidgetDroneEvaluation) {
        return null;
    } else {
        return new EntityAIBase(){//Trick the CC program into thinking this is an executable piece.
            @Override
            public boolean shouldExecute(){
                return false;
            }
        };
    }
}
 
Example #6
Source File: ProgWidgetCustomBlockInteract.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAICustomBlockInteract(drone, (ProgWidgetAreaItemBase)widget, interactor);
}
 
Example #7
Source File: ProgWidgetPlace.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return setupMaxActions(new DroneAIPlace(drone, (ProgWidgetAreaItemBase)widget), (IMaxActions)widget);
}
 
Example #8
Source File: ProgWidgetWait.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return widget instanceof ProgWidgetWait ? widget.getConnectedParameters()[0] != null ? new DroneAIWait((ProgWidgetString)widget.getConnectedParameters()[0]) : null : null;
}
 
Example #9
Source File: ProgWidgetInventoryImport.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneEntityAIInventoryImport(drone, (ProgWidgetAreaItemBase)widget);
}
 
Example #10
Source File: ProgWidgetLiquidImport.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAILiquidImport(drone, (ProgWidgetAreaItemBase)widget);
}
 
Example #11
Source File: ProgWidgetEntityImport.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAIEntityImport(drone, widget);
}
 
Example #12
Source File: ProgWidgetBlockRightClick.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return setupMaxActions(new DroneAIBlockInteract(drone, (ProgWidgetAreaItemBase)widget), (IMaxActions)widget);
}
 
Example #13
Source File: ProgWidget.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetTargetAI(IDroneBase drone, IProgWidget widget){
    return null;
}
 
Example #14
Source File: ProgWidget.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return null;
}
 
Example #15
Source File: ProgWidgetCondition.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    evaluator = getEvaluator(drone, widget);
    return evaluator;
}
 
Example #16
Source File: ProgWidgetForEachCoordinate.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return ai = new DroneAIForEachCoordinate(drone, (ProgWidgetForEachCoordinate)widget);
}
 
Example #17
Source File: ProgWidgetSuicide.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAISuicide((EntityDrone)drone);
}
 
Example #18
Source File: ProgWidgetDig.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return setupMaxActions(new DroneAIDig(drone, (ProgWidgetAreaItemBase)widget), (IMaxActions)widget);
}
 
Example #19
Source File: ProgWidgetInventoryExport.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneEntityAIInventoryExport(drone, (ProgWidgetAreaItemBase)widget);
}
 
Example #20
Source File: ProgWidgetGoToLocation.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneEntityAIGoToLocation(drone, (ProgWidget)widget);
}
 
Example #21
Source File: ProgWidgetEntityAttack.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAIAttackEntity((EntityDrone)drone, 0.1D, false);
}
 
Example #22
Source File: ProgWidgetEntityAttack.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetTargetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAINearestAttackableTarget((EntityDrone)drone, 0, false, (ProgWidget)widget);
}
 
Example #23
Source File: ProgWidgetLogistics.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAILogistics(drone, (ProgWidgetAreaItemBase)widget);
}
 
Example #24
Source File: ProgWidgetExternalProgram.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAIExternalProgram(drone, aiManager, (ProgWidgetExternalProgram)widget);
}
 
Example #25
Source File: ProgWidgetCrafting.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAICrafting(drone, (ICraftingWidget)widget);
}
 
Example #26
Source File: EntityAITasksWrapper.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void addTask(int index, EntityAIBase ai) {
    if(!isLocked()) {
        original.addTask(index, ai);
    }
}
 
Example #27
Source File: ProgWidgetLiquidExport.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAIBase getWidgetAI(IDroneBase drone, IProgWidget widget){
    return new DroneAILiquidExport(drone, (ProgWidgetAreaItemBase)widget);
}
 
Example #28
Source File: AIShutdownWhitelist.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void whitelistAIClass(Class<? extends EntityLiving> entityClass, Class<? extends EntityAIBase> aiClass) {
    if(!whitelistedAI.containsKey(entityClass)) {
        whitelistedAI.put(entityClass, new LinkedList<Class<? extends EntityAIBase>>());
    }
    whitelistedAI.get(entityClass).add(aiClass);
}
 
Example #29
Source File: AIShutdownWhitelist.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void whitelistAIClass(EntityLiving entity, Class<? extends EntityAIBase> aiClass) {
    whitelistAIClass(entity.getClass(), aiClass);
}
 
Example #30
Source File: AIShutdownWhitelist.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static List<Class<? extends EntityAIBase>> getWhitelistedAIClasses(EntityLiving entity) {
    if(!whitelistedAI.containsKey(entity.getClass())) return Lists.newArrayList();
    return whitelistedAI.get(entity.getClass());
}