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


Java PathEntity类代码示例

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


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

示例1: canEasilyReach

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
/**
 * Checks to see if this entity can find a short path to the given target.
 */
private boolean canEasilyReach(EntityLivingBase p_75295_1_)
{
    this.targetSearchDelay = 10 + this.taskOwner.getRNG().nextInt(5);
    PathEntity pathentity = this.taskOwner.getNavigator().getPathToEntityLiving(p_75295_1_);

    if (pathentity == null)
    {
        return false;
    }
    else
    {
        PathPoint pathpoint = pathentity.getFinalPathPoint();

        if (pathpoint == null)
        {
            return false;
        }
        else
        {
            int i = pathpoint.xCoord - MathHelper.floor_double(p_75295_1_.posX);
            int j = pathpoint.zCoord - MathHelper.floor_double(p_75295_1_.posZ);
            return (double)(i * i + j * j) <= 2.25D;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:EntityAITarget.java

示例2: handleFear

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
private void handleFear() {
	if (getEntityFear() != null) {
		if (getEntityFear().isDead) {
			// Don't fear the dead.
			setEntityFear(null);
		} else if (!hasPath() && canEntityBeSeen(getEntityFear())
				&& willCower()) {
			float dist = getDistanceToEntity(getEntityFear());

			// Run from entityFear if you can see it and it is close.
			if (dist < FairyConfig.BEHAVIOR_FEAR_RANGE) {
				PathEntity dest = roam(getEntityFear(), this, PATH_AWAY);

				if (dest != null) {
					setPathToEntity(dest);
					setCryTime(getCryTime() + 120);
				}
			}
		}
	}
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:22,代码来源:EntityFairy.java

示例3: doHeal

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
private void doHeal(EntityLivingBase guy) {
	armSwing(!didSwing); // Swings arm and heals the specified person.
	EntityPotion potion = new EntityPotion(worldObj, this,
			handPotion().getItemDamage());
	worldObj.spawnEntityInWorld(potion);

	// potion.onImpact(new MovingObjectPosition(guy));
	try {
		final Method onImpact = ReflectionHelper.findMethod(
				EntityPotion.class, potion, MCP_ONIMPACT,
				MovingObjectPosition.class);
		onImpact.invoke(potion, new MovingObjectPosition(guy));
	} catch (Exception e) {
		e.printStackTrace();
	}

	setPathToEntity((PathEntity) null);
	healTime = 200;
	setRarePotion(rand.nextInt(4) == 0);
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:21,代码来源:EntityFairy.java

示例4: castRod

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
public void castRod() {
	if (fishEntity != null) {
		fishEntity.catchFish();
		armSwing(!didSwing);
		setSitting(false);
	} else {
		worldObj.playSoundAtEntity(this, "random.bow", 0.5F,
				0.4F / ( rand.nextFloat() * 0.4F + 0.8F ));
		FairyEntityFishHook hook = new FairyEntityFishHook(worldObj, this);
		worldObj.spawnEntityInWorld(hook);
		armSwing(!didSwing);
		setTempItem(Items.stick);
		setSitting(true);
		isJumping = false;
		setPathToEntity((PathEntity) null);
		setTarget((Entity) null);
		entityFear = null;
	}
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:20,代码来源:EntityFairy.java

示例5: getToLand

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
private void getToLand( final int x, final int y, final int z, final World world ) {
	for ( int q = 0; q < 16; q++ ) {
		final int i = x - 5 + fairy.getRNG().nextInt( 11 );
		final int j = y + 1 + fairy.getRNG().nextInt( 5 );
		final int k = z - 5 + fairy.getRNG().nextInt( 11 );

		if ( y > 1 && y < world.getHeight() - 1 ) {
			if ( fairy.isAirySpace( i, j, k ) && !fairy.isAirySpace( i, j - 1, k )
					&& world.getBlock( i, j - 1, k ).isBlockNormalCube() ) {
				final PathEntity doug = world.getEntityPathToXYZ( fairy, i, j, k, 16F, false, false, true, true );

				if ( doug != null ) {
					fairy.setPathToEntity( doug );

					if ( !fairy.flymode() ) {
						fairy.setFlyTime( 0 );
					}

					return;
				}
			}
		}
	}
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:25,代码来源:FairyJob.java

示例6: canEasilyReach

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
private boolean canEasilyReach(EntityLivingBase p_75295_1_)
{
    this.targetSearchDelay = 10 + this.taskOwner.getRNG().nextInt(5);
    PathEntity pathentity = this.taskOwner.getNavigator().getPathToEntityLiving(p_75295_1_);

    if (pathentity == null)
    {
        return false;
    }
    else
    {
        PathPoint pathpoint = pathentity.getFinalPathPoint();

        if (pathpoint == null)
        {
            return false;
        }
        else
        {
            int i = pathpoint.xCoord - MathHelper.floor_double(p_75295_1_.posX);
            int j = pathpoint.zCoord - MathHelper.floor_double(p_75295_1_.posZ);
            return (double)(i * i + j * j) <= 2.25D;
        }
    }
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:26,代码来源:EntityBonnieAITarget.java

示例7: getPathEntityToEntity

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
public PathEntity getPathEntityToEntity(Entity par1Entity, Entity par2Entity, float par3, boolean par4, boolean par5, boolean par6, boolean par7)
{
    this.theProfiler.startSection("pathfind");
    int var8 = MathHelper.floor_double(par1Entity.posX);
    int var9 = MathHelper.floor_double(par1Entity.posY + 1.0D);
    int var10 = MathHelper.floor_double(par1Entity.posZ);
    int var11 = (int)(par3 + 16.0F);
    int var12 = var8 - var11;
    int var13 = var9 - var11;
    int var14 = var10 - var11;
    int var15 = var8 + var11;
    int var16 = var9 + var11;
    int var17 = var10 + var11;
    ChunkCache var18 = new ChunkCache(this, var12, var13, var14, var15, var16, var17, 0);
    PathEntity var19 = (new PathFinder(var18, par4, par5, par6, par7)).createEntityPathTo(par1Entity, par2Entity, par3);
    this.theProfiler.endSection();
    return var19;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:World.java

示例8: getEntityPathToXYZ

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
public PathEntity getEntityPathToXYZ(Entity par1Entity, int par2, int par3, int par4, float par5, boolean par6, boolean par7, boolean par8, boolean par9)
{
    this.theProfiler.startSection("pathfind");
    int var10 = MathHelper.floor_double(par1Entity.posX);
    int var11 = MathHelper.floor_double(par1Entity.posY);
    int var12 = MathHelper.floor_double(par1Entity.posZ);
    int var13 = (int)(par5 + 8.0F);
    int var14 = var10 - var13;
    int var15 = var11 - var13;
    int var16 = var12 - var13;
    int var17 = var10 + var13;
    int var18 = var11 + var13;
    int var19 = var12 + var13;
    ChunkCache var20 = new ChunkCache(this, var14, var15, var16, var17, var18, var19, 0);
    PathEntity var21 = (new PathFinder(var20, par6, par7, par8, par9)).createEntityPathTo(par1Entity, par2, par3, par4, par5);
    this.theProfiler.endSection();
    return var21;
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:19,代码来源:World.java

示例9: canEasilyReach

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
/**
 * Checks to see if this entity can find a short path to the given target.
 */
private boolean canEasilyReach(EntityLivingBase par1EntityLivingBase)
{
    this.targetSearchDelay = 10 + this.taskOwner.getRNG().nextInt(5);
    PathEntity var2 = this.taskOwner.getNavigator().getPathToEntityLiving(par1EntityLivingBase);

    if (var2 == null)
    {
        return false;
    }
    else
    {
        PathPoint var3 = var2.getFinalPathPoint();

        if (var3 == null)
        {
            return false;
        }
        else
        {
            int var4 = var3.xCoord - MathHelper.floor_double(par1EntityLivingBase.posX);
            int var5 = var3.zCoord - MathHelper.floor_double(par1EntityLivingBase.posZ);
            return (double)(var4 * var4 + var5 * var5) <= 2.25D;
        }
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:29,代码来源:EntityAITarget.java

示例10: shouldExecute

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
@Override
public boolean shouldExecute() {
    EntityLivingBase target = golem.getAttackTarget();
    if (target == null) {
        return false;
    }

    PathEntity pathEntity = golem.getNavigator().getPathToEntityLiving(target);
    if(pathEntity != null) {
        INJECTOR.setObject(this);
        INJECTOR.setField("entityPathEntity", pathEntity);
        INJECTOR.setField("entityTarget", target);
        return true;
    }

    return false;
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:18,代码来源:AIUncheckedAttackOnCollide.java

示例11: tame

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
/**
    * Called when taming has succeeded
    * @param player the player taming the creature
    */
   private void tame(EntityPlayer player, boolean success)
   {
   	if (this.worldObj.isRemote)
       {
   		return;
       }
       if (success)
       {
           this.setTamed(true); //Dog Will Tame
           this.setPathToEntity((PathEntity)null); //Dog Will Stop Moving
           this.setAttackTarget((EntityLiving)null); //Dog Will Cease Combat
           this.setOwner(player.username); //Sets The Owner
           this.playTameEffect(true); //Create Hearts
           this.worldObj.setEntityState(this, (byte)7); //Set Tame
           command("Follow");
           
           refreshHealth();
       }
       else
       {
           this.playTameEffect(false); //Fail look
           this.worldObj.setEntityState(this, (byte)6); //Set Fail
       }
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:29,代码来源:EntityHound.java

示例12: getPathEntityToEntity

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
public PathEntity getPathEntityToEntity(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_)
{
    this.theProfiler.startSection("pathfind");
    int i = MathHelper.floor_double(p_72865_1_.posX);
    int j = MathHelper.floor_double(p_72865_1_.posY + 1.0D);
    int k = MathHelper.floor_double(p_72865_1_.posZ);
    int l = (int)(p_72865_3_ + 16.0F);
    int i1 = i - l;
    int j1 = j - l;
    int k1 = k - l;
    int l1 = i + l;
    int i2 = j + l;
    int j2 = k + l;
    ChunkCache chunkcache = new ChunkCache(this, i1, j1, k1, l1, i2, j2, 0);
    PathEntity pathentity = (new PathFinder(chunkcache, p_72865_4_, p_72865_5_, p_72865_6_, p_72865_7_)).createEntityPathTo(p_72865_1_, p_72865_2_, p_72865_3_);
    this.theProfiler.endSection();
    return pathentity;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:19,代码来源:World.java

示例13: getEntityPathToXYZ

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
public PathEntity getEntityPathToXYZ(Entity p_72844_1_, int p_72844_2_, int p_72844_3_, int p_72844_4_, float p_72844_5_, boolean p_72844_6_, boolean p_72844_7_, boolean p_72844_8_, boolean p_72844_9_)
{
    this.theProfiler.startSection("pathfind");
    int l = MathHelper.floor_double(p_72844_1_.posX);
    int i1 = MathHelper.floor_double(p_72844_1_.posY);
    int j1 = MathHelper.floor_double(p_72844_1_.posZ);
    int k1 = (int)(p_72844_5_ + 8.0F);
    int l1 = l - k1;
    int i2 = i1 - k1;
    int j2 = j1 - k1;
    int k2 = l + k1;
    int l2 = i1 + k1;
    int i3 = j1 + k1;
    ChunkCache chunkcache = new ChunkCache(this, l1, i2, j2, k2, l2, i3, 0);
    PathEntity pathentity = (new PathFinder(chunkcache, p_72844_6_, p_72844_7_, p_72844_8_, p_72844_9_)).createEntityPathTo(p_72844_1_, p_72844_2_, p_72844_3_, p_72844_4_, p_72844_5_);
    this.theProfiler.endSection();
    return pathentity;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:19,代码来源:World.java

示例14: func_75295_a

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
private boolean func_75295_a(EntityLivingBase par1EntityLiving) {
    this.pathCheckCooldown = 10 + this.taskOwner.getRNG().nextInt(5);
    PathEntity var2 = this.taskOwner.getNavigator().getPathToEntityLiving(par1EntityLiving);

    if (var2 == null) {
        return false;
    } else {
        PathPoint var3 = var2.getFinalPathPoint();

        if (var3 == null) {
            return false;
        } else {
            int var4 = var3.xCoord - MathHelper.floor_double(par1EntityLiving.posX);
            int var5 = var3.zCoord - MathHelper.floor_double(par1EntityLiving.posZ);
            return (double) (var4 * var4 + var5 * var5) <= 2.25D;
        }
    }
}
 
开发者ID:soultek101,项目名称:projectzulu1.7.10-pre-1.3a,代码行数:19,代码来源:EntityAITarget.java

示例15: func_72865_a

import net.minecraft.pathfinding.PathEntity; //导入依赖的package包/类
public PathEntity func_72865_a(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_) {
   this.field_72984_F.func_76320_a("pathfind");
   int var8 = MathHelper.func_76128_c(p_72865_1_.field_70165_t);
   int var9 = MathHelper.func_76128_c(p_72865_1_.field_70163_u + 1.0D);
   int var10 = MathHelper.func_76128_c(p_72865_1_.field_70161_v);
   int var11 = (int)(p_72865_3_ + 16.0F);
   int var12 = var8 - var11;
   int var13 = var9 - var11;
   int var14 = var10 - var11;
   int var15 = var8 + var11;
   int var16 = var9 + var11;
   int var17 = var10 + var11;
   ChunkCache var18 = new ChunkCache(this, var12, var13, var14, var15, var16, var17, 0);
   PathEntity var19 = (new PathFinder(var18, p_72865_4_, p_72865_5_, p_72865_6_, p_72865_7_)).func_75856_a(p_72865_1_, p_72865_2_, p_72865_3_);
   this.field_72984_F.func_76319_b();
   return var19;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:18,代码来源:World.java


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