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