本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
}
示例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));
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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