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


Java RandomPositionGenerator类代码示例

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


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

示例1: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
@Override
public boolean shouldExecute() {
	if (this.mayNotUpdate && this.entity.getRNG().nextInt(this.executionChance) != 0)
		return false;

	Vec3d vec3d = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);
	int wanderTargetAttempts = 0;
	while (wanderTargetAttempts < 10 && (vec3d == null || !entity.isWithinHomeDistanceFromPosition(new BlockPos(vec3d)))) {
		vec3d = RandomPositionGenerator.findRandomTarget(this.entity, 12, 8);
		wanderTargetAttempts++;
	}

	if (vec3d == null || wanderTargetAttempts >= 10)
		return false;
	else {
		this.xPosition = vec3d.x;
		this.yPosition = vec3d.y;
		this.zPosition = vec3d.z;
		this.mayNotUpdate = true;
		return true;
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:23,代码来源:EntityAIWanderBase.java

示例2: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
public boolean shouldExecute() {

		if (!enabled) {
			return false;
		}

		if (inCorrectPosition()) {
			return false;
		}

		Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.entity, 16, 7, new Vec3d((double) centerX, (double) entity.posY, (double) centerZ));

		if (vec3d == null) {
			return false;
		} else {
			this.movePosX = vec3d.x;
			this.movePosY = vec3d.y;
			this.movePosZ = vec3d.z;
			return true;
		}

	}
 
开发者ID:ToroCraft,项目名称:ToroQuest,代码行数:23,代码来源:EntityAIMoveIntoArea.java

示例3: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute() {

    Vec3d vec3d = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4);

    if (vec3d == null) {
        return false;
    } else {
        this.randPosX = vec3d.x;
        this.randPosY = vec3d.y;
        this.randPosZ = vec3d.z;

        if (this.theEntityCreature.isBurning()) {
            BlockPos blockpos = this.getRandPos(this.theEntityCreature.world, this.theEntityCreature, 5, 4);

            if (blockpos != null) {
                this.randPosX = (double) blockpos.getX();
                this.randPosY = (double) blockpos.getY();
                this.randPosZ = (double) blockpos.getZ();
            }
        }

        return true;
    }

}
 
开发者ID:TeamFRM,项目名称:TAIGA,代码行数:29,代码来源:EntityAIPermanentPanic.java

示例4: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
public boolean shouldExecute()
{
    if (this.theEntity.isWithinHomeDistanceCurrentPosition())
    {
        return false;
    }
    else
    {
        ChunkCoordinates chunkcoordinates = this.theEntity.getHomePosition();
        Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, Vec3.createVectorHelper((double)chunkcoordinates.posX, (double)chunkcoordinates.posY, (double)chunkcoordinates.posZ));

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.movePosX = vec3.xCoord;
            this.movePosY = vec3.yCoord;
            this.movePosZ = vec3.zCoord;
            return true;
        }
    }
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:25,代码来源:EntityBonnieAIMoveTowardsRestriction.java

示例5: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	Herd myHerd = HerdCraft.herdCollectionObj.handleNearestHerdOrMakeNew(entity, entityEffectiveClass, minBreed, maxBreed, baseBreed, varBreed); 
	if (this.entity.getAITarget() != null)
	{
		myHerd.setEnemy(entity.getAITarget());
	}
    if (myHerd.getEnemy() == null)
    {
        return false;
    }
    
    Vec3 pathTo = RandomPositionGenerator.findRandomTarget(this.entity, 5, 4);
    if (pathTo == null)
    {
        return false;
    }
    else
    {
        this.randPosX = pathTo.xCoord;
        this.randPosY = pathTo.yCoord;
        this.randPosZ = pathTo.zCoord;
        return this.entity.getNavigator().tryMoveToXYZ(this.randPosX, this.randPosY, this.randPosZ, this.speed);
    }
}
 
开发者ID:MinecraftModArchive,项目名称:Herdcraft,代码行数:29,代码来源:EntityAIHerdPanic.java

示例6: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	Herd myHerd = HerdCraft.herdCollectionObj.handleNearestHerdOrMakeNew(entity, entityEffectiveClass, minBreed, maxBreed, baseBreed, varBreed); 
	if (this.entity.getAITarget() != null)
	{
		myHerd.setEnemy(entity.getAITarget());
	}
    if (myHerd.getEnemy() == null)
    {
        return false;
    }
    
    Vec3 var1 = RandomPositionGenerator.findRandomTargetBlockTowards(this.entity, 15, 4, Vec3.createVectorHelper(entity.posX + myHerd.fleeIn.xCoord * 30.0d, entity.posY, entity.posZ + myHerd.fleeIn.zCoord * 30.0d));
    if (var1 == null)
    {
    	return false;
    }
    fleeX = var1.xCoord;
    fleeY = var1.yCoord;
    fleeZ = var1.zCoord;
    return true;
}
 
开发者ID:MinecraftModArchive,项目名称:Herdcraft,代码行数:26,代码来源:EntityAIHerdStampede.java

示例7: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute() {
    if (this.entity.getAge() >= 100)
        return false;
    else if (this.entity.getRNG().nextInt(120) != 0)
        return false;
    else {
        Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);
        if (vec3 == null)
            return false;
        else {
            this.xPos = vec3.xCoord;
            this.yPos = vec3.yCoord;
            this.zPos = vec3.zCoord;
            return true;
        }
    }
}
 
开发者ID:CosmicDan-Minecraft,项目名称:Imperium,代码行数:21,代码来源:EntityAIFlockMentality.java

示例8: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute() {
    if (!this.entity.onGround) {
        return false;
    }

    Vec3d vec3d = RandomPositionGenerator.findRandomTarget(entity, 10, 7);

    if (vec3d == null) {
        return false;
    } else {
        this.xPath = vec3d.x;
        this.yPath = vec3d.y;
        this.zPath = vec3d.z;
        return this.theWorld.isFlammableWithin(this.entity.getEntityBoundingBox().contract(0.001, 0.001, 0.001));
    }
}
 
开发者ID:NightKosh,项目名称:Sophisticated-wolves,代码行数:21,代码来源:EntityAIAvoidFire.java

示例9: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
@Override
public boolean shouldExecute() {

	if ((Math.abs(this.entity.posX - this.entity.xOrigin) <= entity.radiusOfTown) && (Math.abs(this.entity.posY - this.entity.yOrigin) <= entity.radiusOfTown) && (Math.abs(this.entity.posZ - this.entity.zOrigin) <= entity.radiusOfTown)) {
		Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.entity, 10, 7);
		if (var1 == null) {
			return false;
		}
		else {
			if ((Math.abs(var1.xCoord - entity.xOrigin) <= entity.radiusOfTown) && (Math.abs(var1.yCoord - entity.yOrigin) <= entity.radiusOfTown) && (Math.abs(var1.zCoord - entity.zOrigin) <= entity.radiusOfTown)) {
				this.xPosition = var1.xCoord;
				this.yPosition = var1.yCoord;
				this.zPosition = var1.zCoord;
			}
			return true;
		}
	}
	else {
		this.xPosition = this.entity.xOrigin;
		this.yPosition = this.entity.yOrigin;
		this.zPosition = this.entity.zOrigin;
		return true;
	}

}
 
开发者ID:kieranvs,项目名称:Blockbender,代码行数:26,代码来源:EntityAIWanderInTown.java

示例10: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute() {
	if (this.entity.getRNG().nextInt(120) != 0) {
		return false;
	} else {
		Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.entity,
				10, 7);

		if (var1 == null) {
			return false;
		} else {
			this.xPosition = var1.xCoord;
			this.yPosition = var1.yCoord;
			this.zPosition = var1.zCoord;
			return true;
		}
	}
}
 
开发者ID:Katalliaan,项目名称:Rubedo,代码行数:22,代码来源:EntityAITweakedWandering.java

示例11: func_75246_d

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
public void func_75246_d() {
   --this.field_75259_d;
   if(this.field_75260_b != null) {
      if(this.field_75262_a.func_70068_e(this.field_75260_b) > 4.0D) {
         this.field_75262_a.func_70661_as().func_75497_a(this.field_75260_b, this.field_75261_c);
      }
   } else if(this.field_75262_a.func_70661_as().func_75500_f()) {
      Vec3 var1 = RandomPositionGenerator.func_75463_a(this.field_75262_a, 16, 3);
      if(var1 == null) {
         return;
      }

      this.field_75262_a.func_70661_as().func_75492_a(var1.field_72450_a, var1.field_72448_b, var1.field_72449_c, this.field_75261_c);
   }

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

示例12: func_75250_a

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
public boolean func_75250_a() {
   if(this.field_75436_a.func_110173_bK()) {
      return false;
   } else {
      ChunkCoordinates var1 = this.field_75436_a.func_110172_bL();
      Vec3 var2 = RandomPositionGenerator.func_75464_a(this.field_75436_a, 16, 7, this.field_75436_a.field_70170_p.func_82732_R().func_72345_a((double)var1.field_71574_a, (double)var1.field_71572_b, (double)var1.field_71573_c));
      if(var2 == null) {
         return false;
      } else {
         this.field_75434_b = var2.field_72450_a;
         this.field_75435_c = var2.field_72448_b;
         this.field_75432_d = var2.field_72449_c;
         return true;
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:EntityAIMoveTowardsRestriction.java

示例13: func_75250_a

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
public boolean func_75250_a() {
   if(this.field_75457_a.func_70654_ax() >= 100) {
      return false;
   } else if(this.field_75457_a.func_70681_au().nextInt(120) != 0) {
      return false;
   } else {
      Vec3 var1 = RandomPositionGenerator.func_75463_a(this.field_75457_a, 10, 7);
      if(var1 == null) {
         return false;
      } else {
         this.field_75455_b = var1.field_72450_a;
         this.field_75456_c = var1.field_72448_b;
         this.field_75453_d = var1.field_72449_c;
         return true;
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:18,代码来源:EntityAIWander.java

示例14: func_75250_a

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
public boolean func_75250_a() {
   this.field_75429_b = this.field_75431_a.func_70638_az();
   if(this.field_75429_b == null) {
      return false;
   } else if(this.field_75429_b.func_70068_e(this.field_75431_a) > (double)(this.field_75426_g * this.field_75426_g)) {
      return false;
   } else {
      Vec3 var1 = RandomPositionGenerator.func_75464_a(this.field_75431_a, 16, 7, this.field_75431_a.field_70170_p.func_82732_R().func_72345_a(this.field_75429_b.field_70165_t, this.field_75429_b.field_70163_u, this.field_75429_b.field_70161_v));
      if(var1 == null) {
         return false;
      } else {
         this.field_75430_c = var1.field_72450_a;
         this.field_75427_d = var1.field_72448_b;
         this.field_75428_e = var1.field_72449_c;
         return true;
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:19,代码来源:EntityAIMoveTowardsTarget.java

示例15: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入依赖的package包/类
@Override
public boolean shouldExecute() {
  if (theEntityCreature.getRevengeTarget() == null && !theEntityCreature.isBurning()) {
    return false;
  }
  Vec3d vec3 = RandomPositionGenerator.findRandomTarget(theEntityCreature, 5, 4);
  if (vec3 == null) {
    return false;
  }
  double yOffset = 1 + theEntityCreature.getEntityWorld().rand.nextInt(3);
  //double yOffset = 0;
  randPosX = vec3.x;
  randPosY = vec3.y + yOffset;
  randPosZ = vec3.z;
  return true;
}
 
开发者ID:SleepyTrousers,项目名称:EnderZoo,代码行数:17,代码来源:EntityAIFlyingPanic.java


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