当前位置: 首页>>代码示例>>Java>>正文


Java EntityAIBase类代码示例

本文整理汇总了Java中net.minecraft.entity.ai.EntityAIBase的典型用法代码示例。如果您正苦于以下问题:Java EntityAIBase类的具体用法?Java EntityAIBase怎么用?Java EntityAIBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntityAIBase类属于net.minecraft.entity.ai包,在下文中一共展示了EntityAIBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeTask

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
/**
 * 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();
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:21,代码来源:DroneAIManager.java

示例2: initEntityAI

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
@Override
protected void initEntityAI() {
	super.initEntityAI();
	EntityAIBase remove = null;
	for(EntityAITaskEntry task : this.tasks.taskEntries) {
		if(task.action.getClass().getSimpleName().equals("AIFireballAttack")) {
			remove = task.action;
			break;
		}
	}
	if(remove != null) {
		this.tasks.removeTask(remove);
		this.tasks.addTask(7, new AIUnderworldFireballAttack(this));
	} else {
		Log.logger.error(this.getName() + " failed to override Ghast fireball AI.");
	}
}
 
开发者ID:sblectric,项目名称:LightningCraft,代码行数:18,代码来源:EntityUnderworldGhast.java

示例3: generateAIList

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
private String[] generateAIList(boolean target)
{
    Iterator<Class<? extends EntityAIBase>> it = CustomAIHelper.isTarget.keySet().iterator();
    ArrayList<String> list = new ArrayList<String>();
    while(it.hasNext())
    {
        Class<? extends EntityAIBase> c = it.next();
        Boolean bool = CustomAIHelper.isTarget.get(c);
        if(bool == null)
            ;
        else if(bool)
        {
            if(target && CustomAIHelper.isSuitableForEntity((EntityLiving) entity, c))
                list.add(CustomAIHelper.getNameFromClass(c));
        }
        else
        {
            if(!target && CustomAIHelper.isSuitableForEntity((EntityLiving) entity, c))
                list.add(CustomAIHelper.getNameFromClass(c));
        }
    }
    
    return list.toArray(new String[0]);
}
 
开发者ID:jglrxavpok,项目名称:CustomAI,代码行数:25,代码来源:GuiCustomAI.java

示例4: generateAIList

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
private String[] generateAIList(boolean target)
{
    Iterator<Class<? extends EntityAIBase>> it = CustomAIHelper.isTarget.keySet().iterator();
    ArrayList<String> list = new ArrayList<String>();
    while(it.hasNext())
    {
        Class<? extends EntityAIBase> c = it.next();
        Boolean bool = CustomAIHelper.isTarget.get(c);
        if(bool == null)
            ;
        else if(bool)
        {
            if(target)
                list.add(CustomAIHelper.getNameFromClass(c));
        }
        else
        {
            if(!target)
                list.add(CustomAIHelper.getNameFromClass(c));
        }
    }
    
    return list.toArray(new String[0]);
}
 
开发者ID:jglrxavpok,项目名称:CustomAI,代码行数:25,代码来源:GuiAIEmitter.java

示例5: getWorkerFromClass

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
public EntityAIWorker getWorkerFromClass(Class<? extends EntityAIBase> c)
{
    Set<Class<? extends EntityAIBase>[]> keys = workerRegistry.keySet();
    Iterator<Class<? extends EntityAIBase>[]> it = keys.iterator();
    while(it.hasNext())
    {
        Class<? extends EntityAIBase>[] classes = it.next();
        for(Class<? extends EntityAIBase> clazz : classes)
        {
            if(clazz == c)
            {
                return workerRegistry.get(classes);
            }
        }
    }
    return null;
}
 
开发者ID:jglrxavpok,项目名称:CustomAI,代码行数:18,代码来源:EntityAIFactory.java

示例6: removeDummyAIBlockerTask

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:maruohon,项目名称:enderutilities,代码行数:29,代码来源:EntityUtils.java

示例7: func_85156_a

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
public void func_85156_a(EntityAIBase p_85156_1_) {
   Iterator var2 = this.field_75782_a.iterator();

   while(var2.hasNext()) {
      EntityAITaskEntry var3 = (EntityAITaskEntry)var2.next();
      EntityAIBase var4 = var3.field_75733_a;
      if(var4 == p_85156_1_) {
         if(this.field_75780_b.contains(var3)) {
            var4.func_75251_c();
            this.field_75780_b.remove(var3);
         }

         var2.remove();
      }
   }

}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:18,代码来源:EntityAITasks.java

示例8: removeTask

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
/**
 * 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();
        }
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:21,代码来源:DroneAIManager.java

示例9: getWidgetAI

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
@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.getInv().getStackInSlot(0);
            if (stack.getItem().itemInteractionForEntity(stack, drone.getFakePlayer(), targetedEntity, EnumHand.MAIN_HAND)) {
                activated = true;
            }
            if (!activated && targetedEntity instanceof EntityAgeable && ((EntityAgeable) targetedEntity).processInteract(drone.getFakePlayer(), EnumHand.MAIN_HAND)) {
                activated = true;
            }
            DroneAIBlockInteract.transferToDroneFromFakePlayer(drone);
            return false;//return activated; <-- will right click as long as it's sucessfully activated.
        }

    };
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:28,代码来源:ProgWidgetEntityRightClick.java

示例10: getWidgetAI

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
@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;
            }
        };
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:ProgWidgetDroneEvaluation.java

示例11: isEntityAITaskActive

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
public static boolean isEntityAITaskActive(EntityLiving entity, String AIName) {
	for(Object obj : entity.tasks.taskEntries) {
		EntityAITaskEntry taskEntry = (EntityAITaskEntry) obj;
		EntityAIBase task = taskEntry.action;
		if(task instanceof IEntityAIAnimation) {
			IEntityAIAnimation animatedTask = (IEntityAIAnimation) task;
			if(animatedTask.getAIName().equals(AIName) && animatedTask.isExecuting())
				return true;
		}
	}
	return false;
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:13,代码来源:ObsidianAPIUtil.java

示例12: buffedNametag

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.LOW)
public void buffedNametag(EntityInteractEvent event) {
    ItemStack is = event.entityPlayer.getHeldItem();
    if (is == null) return;
    if (is.getItem() != Items.name_tag) return;
    if (!(event.target instanceof EntityLiving)) return;
    final EntityLiving ent = (EntityLiving) event.target;
    final String origName = ent.getCustomNameTag();
    if (!Strings.isNullOrEmpty(origName)) return;
    NBTTagCompound tag = ent.getEntityData();
    final String name = "FZMiscBuffNametags";
    if (tag.hasKey(name)) return;
    tag.setBoolean(name, true);
    ent.tasks.addTask(0, new EntityAIBase() {
        boolean buffApplied = false; // Might not be necessary.
        
        @Override
        public boolean shouldExecute() {
            if (buffApplied) return false;
            buffApplied = true;
            if (ent.getCustomNameTag().equals(origName)) return false;
            float delta = 2*3;
            float origHealth = ent.getMaxHealth();
            float newMaxHealth = origHealth + delta;
            ent.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(newMaxHealth);
            ent.heal(delta);

            EnumParticleTypes particleType = EnumParticleTypes.HEART;
            if (ent instanceof IMob) {
                particleType = EnumParticleTypes.SMOKE_NORMAL;
            }
            if (ent.worldObj instanceof WorldServer) {
                WorldServer ws = (WorldServer) ent.worldObj;
                ws.spawnParticle(particleType, false, ent.posX, ent.posY, ent.posZ, 8, 0.0, 0.0, 0.0, 0.0);
            }
            return false;
        }
    });
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:40,代码来源:BuffNametags.java

示例13: addTask

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
@Override
public boolean addTask(int priority, AIBase ai) {
    if (ai instanceof EntityAIBase) {
        this.addTask(priority, (EntityAIBase) ai);
    } else {
        this.addTask(priority, new NeptuneCustomEntityAI(ai));
    }
    return this.hasTask(ai.getClass());
}
 
开发者ID:NeptunePowered,项目名称:NeptuneMod,代码行数:10,代码来源:MixinEntityAITasks.java

示例14: EntityPeep

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
public EntityPeep(World world){
    super(world);
    this.timeUntilNextEasterEgg = this.rand.nextInt(6000) + 6000;
    EntityAIBase tempt = null;
    for(Object thingy : tasks.taskEntries){
        EntityAITasks.EntityAITaskEntry ai = (EntityAITasks.EntityAITaskEntry)thingy;
        if(ai.action instanceof EntityAITempt) {
            tempt = ai.action;
            break;
        }
    }
    if(tempt !=null)
        this.tasks.removeTask(tempt);
    this.tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.sugar, false));
}
 
开发者ID:SpitefulFox,项目名称:RidiculousWorld,代码行数:16,代码来源:EntityPeep.java

示例15: getNameForTask

import net.minecraft.entity.ai.EntityAIBase; //导入依赖的package包/类
public static String getNameForTask(Class<? extends EntityAIBase> action)
{
    if(map.containsKey(action))
    {
        return map.get(action);
    }
    String s = action.getCanonicalName();
    if(s.contains("."))
    {
        return s.substring(s.lastIndexOf('.')+1);
    }
    return s;
}
 
开发者ID:jglrxavpok,项目名称:CustomAI,代码行数:14,代码来源:CustomAIHelper.java


注:本文中的net.minecraft.entity.ai.EntityAIBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。