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


Java RandomPositionGenerator.findRandomTarget方法代码示例

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


在下文中一共展示了RandomPositionGenerator.findRandomTarget方法的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包/类
/**
 * 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
@Override
public boolean shouldExecute() {
  int chance = executionChance;
  if (isOnLeaves()) {
    chance *= 2;
  }
  if (entity.getRNG().nextInt(chance) != 0) {
    return false;
  }
  
  Vec3d vec3 = RandomPositionGenerator.findRandomTarget(entity, 4, 2);    
  if (vec3 == null || entity.posY - vec3.y < -2) {
    return false;
  }    
  randPosX = vec3.x;
  randPosY = vec3.y;
  randPosZ = vec3.z;
  return true;
}
 
开发者ID:SleepyTrousers,项目名称:EnderZoo,代码行数:20,代码来源:EntityAIFlyingShortWander.java

示例10: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute()
{
    if (this.theEntityCreature.getHealth() > 4F)
    {
        return false;
    }
    else
    {
        Vec3 vec3 = RandomPositionGenerator.findRandomTarget(this.theEntityCreature, 5, 4);

        if (vec3 == null)
        {
            return false;
        }
        else
        {
            this.randPosX = vec3.xCoord;
            this.randPosY = vec3.yCoord;
            this.randPosZ = vec3.zCoord;
            return true;
        }
    }
}
 
开发者ID:wuppy29,项目名称:WuppyMods,代码行数:28,代码来源:EntityAIFleeOnHurt.java

示例11: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	if (((EntityBonnie)entity).isAgressive())
	{
		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.xPosition = vec3.xCoord;
				this.yPosition = vec3.yCoord;
				this.zPosition = vec3.zCoord;
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:35,代码来源:EntityBonnieAIWander.java

示例12: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	if (((EntityCandy)entity).isAgressive())
	{
		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.xPosition = vec3.xCoord;
				this.yPosition = vec3.yCoord;
				this.zPosition = vec3.zCoord;
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:35,代码来源:EntityCandyAIWander.java

示例13: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	if (((EntityChica)entity).isAgressive())
	{
		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.xPosition = vec3.xCoord;
				this.yPosition = vec3.yCoord;
				this.zPosition = vec3.zCoord;
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:35,代码来源:EntityChicaAIWander.java

示例14: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	if (((EntityFredbear)entity).isAgressive())
	{
		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.xPosition = vec3.xCoord;
				this.yPosition = vec3.yCoord;
				this.zPosition = vec3.zCoord;
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:35,代码来源:EntityFredbearAIWander.java

示例15: shouldExecute

import net.minecraft.entity.ai.RandomPositionGenerator; //导入方法依赖的package包/类
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
	if (((EntitySpringbonnie)entity).isAgressive())
	{
		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.xPosition = vec3.xCoord;
				this.yPosition = vec3.yCoord;
				this.zPosition = vec3.zCoord;
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Link1234Gamer,项目名称:FiveNightsAtFreddysUniverseMod,代码行数:35,代码来源:EntitySpringbonnieAIWander.java


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