Java源码示例:net.minecraft.entity.monster.AbstractIllager

示例1
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
   protected void initEntityAI() {
       this.tasks.addTask(0, new AIDoNothing());
       this.tasks.addTask(3, new AIHealSpell());
       this.tasks.addTask(4, new AISoyShot());
       this.tasks.addTask(5, new AITofuShoot());
       this.tasks.addTask(6, new AISummonSpell());
       this.tasks.addTask(7, new EntityAIAttackMoveRanged(this, 1.0D, 60, 16.0F) {
           @Override
           public boolean shouldExecute() {
               return super.shouldExecute() && !isSpellcasting() && !isSoyShot();
           }

           @Override
           public boolean shouldContinueExecuting() {
               return super.shouldContinueExecuting() && !isSpellcasting();
           }
       });
       this.tasks.addTask(8, new EntityAIWanderAvoidWater(this, 1.1D));
       this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
       this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
       this.tasks.addTask(9, new EntityAILookIdle(this));
       this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
       this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
       this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<>(this, EntityTofunian.class, true));
       this.targetTasks.addTask(4, new EntityAINearestAttackableTarget<>(this, AbstractIllager.class, true));
       this.targetTasks.addTask(5, new EntityAINearestAttackableTarget<>(this, EntityIronGolem.class, true));
   }
 
示例2
public void updateEntityAI() {

        if (!this.isAleadyUpdate) {
            if (canGuard()) {
                this.tasks.addTask(1, new EntityAIAttackMelee(this, 0.65F, true));
                this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityTofuChinger.class, false));
                this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityZombie.class, false));
                this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, AbstractIllager.class, false));
                this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityVex.class, false));
                this.targetTasks.addTask(1, new EntityAINearestAttackableTarget<>(this, EntityTofuGandlem.class, false));

                if (!this.isChild()) {
                    this.tasks.addTask(6, new EntityAIUseItemOnLeftHand<>(this, new ItemStack(ItemLoader.bugle), TofuSounds.TOFUBUGLE, (p_213736_1_) -> {
                        return WorldUtils.isMorning(this.world) && this.world.rand.nextInt(350) == 0;
                    }));
                }
            } else {
                this.tasks.addTask(1, new EntityAITofunianAvoidEntity<>(this, EntityTofuChinger.class, 8.0F, 0.6D, 0.6D));
                this.tasks.addTask(1, new EntityAITofunianAvoidEntity<>(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
                this.tasks.addTask(1, new EntityAITofunianAvoidEntity<>(this, AbstractIllager.class, 8.0F, 0.8D, 0.8D));
                this.tasks.addTask(1, new EntityAITofunianAvoidEntity<>(this, EntityVex.class, 8.0F, 0.6D, 0.6D));
                this.tasks.addTask(1, new EntityAITofunianAvoidEntity<>(this, EntityTofuGandlem.class, 8.0F, 0.8D, 0.8D));

                this.tasks.addTask(2, new EntityAIPanic(this, 0.75F));
            }


            if (canFarm() && !this.isChild()) {
                this.tasks.addTask(8, new EntityAIHarvestTofuFarmland(this, 0.6D));
            }

            if ((canFarm() || canFish()) && !this.isChild()) {
                this.tasks.addTask(8, new EntityAIMakingFood(this, 0.6D));
            }
            this.isAleadyUpdate = true;
        }
    }
 
示例3
protected void initEntityAI() {
    super.initEntityAI();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIRestrictOpenDoor(this));
    this.tasks.addTask(2, new EntityAIOpenDoor(this, true));
    this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, false));
    this.tasks.addTask(8, new EntityAIWander(this, 0.6D));
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 3.0F, 1.0F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true, new Class[]{AbstractIllager.class}));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityPlayer>(this, EntityPlayer.class, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityVillager>(this, EntityVillager.class, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityIronGolem>(this, EntityIronGolem.class, true));
}
 
示例4
@SideOnly(Side.CLIENT)
public AbstractIllager.IllagerArmPose getArmPose() {
    return this.isAggressive() ? AbstractIllager.IllagerArmPose.ATTACKING : AbstractIllager.IllagerArmPose.CROSSED;
}
 
示例5
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {
    this.head.rotateAngleY = netHeadYaw * 0.017453292F;
    this.head.rotateAngleX = headPitch * 0.017453292F;
    this.arms.rotationPointY = 3.0F;
    this.arms.rotationPointZ = -1.0F;
    this.arms.rotateAngleX = -0.75F;
    this.leg0.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F;
    this.leg1.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 1.4F * limbSwingAmount * 0.5F;
    this.leg0.rotateAngleY = 0.0F;
    this.leg1.rotateAngleY = 0.0F;
    AbstractIllager.IllagerArmPose abstractillager$illagerarmpose = ((AbstractIllager) entityIn).getArmPose();

    if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.ATTACKING) {
        float f = MathHelper.sin(this.swingProgress * (float) Math.PI);
        float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float) Math.PI);
        this.rightArm.rotateAngleZ = -0.3363323129985824F;
        this.leftArm.rotateAngleZ = 0.3363323129985824F;
        this.rightArm.rotateAngleY = -0.3363323129985824F;
        this.leftArm.rotateAngleY = 0.3363323129985824F;

        if (((EntityLivingBase) entityIn).getPrimaryHand() == EnumHandSide.RIGHT) {
            this.rightArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
            this.leftArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
            this.rightArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
            this.leftArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
        } else {
            this.rightArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
            this.leftArm.rotateAngleX = -1.4849558F + MathHelper.cos(ageInTicks * 0.09F) * 0.15F;
            this.rightArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
            this.leftArm.rotateAngleX += f * 2.2F - f1 * 0.4F;
        }

        this.rightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
        this.leftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
        this.rightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.09F) * 0.05F;
        this.leftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.09F) * 0.05F;
    } else if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.SPELLCASTING) {
        this.rightArm.rotationPointZ = 0.0F;
        this.rightArm.rotationPointX = -5.0F;
        this.leftArm.rotationPointZ = 0.0F;
        this.leftArm.rotationPointX = 5.0F;
        this.rightArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
        this.leftArm.rotateAngleX = MathHelper.cos(ageInTicks * 0.6662F) * 0.25F;
        this.rightArm.rotateAngleZ = 2.3561945F;
        this.leftArm.rotateAngleZ = -2.3561945F;
        this.rightArm.rotateAngleY = 0.0F;
        this.leftArm.rotateAngleY = 0.0F;
    } else if (abstractillager$illagerarmpose == AbstractIllager.IllagerArmPose.BOW_AND_ARROW) {
        this.rightArm.rotateAngleY = -0.1F + this.head.rotateAngleY;
        this.rightArm.rotateAngleX = -((float) Math.PI / 2F) + this.head.rotateAngleX;
        this.leftArm.rotateAngleX = -0.9424779F + this.head.rotateAngleX;
        this.leftArm.rotateAngleY = this.head.rotateAngleY - 0.4F;
        this.leftArm.rotateAngleZ = ((float) Math.PI / 2F);
    }
}
 
示例6
public CraftIllager(CraftServer server, AbstractIllager entity) {
    super(server, entity);
}
 
示例7
@Override
public AbstractIllager getHandle() {
    return (AbstractIllager) super.getHandle();
}