本文整理匯總了Java中net.minecraft.pathfinding.PathNavigate類的典型用法代碼示例。如果您正苦於以下問題:Java PathNavigate類的具體用法?Java PathNavigate怎麽用?Java PathNavigate使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PathNavigate類屬於net.minecraft.pathfinding包,在下文中一共展示了PathNavigate類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: shouldExecute
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
@Override
public boolean shouldExecute() {
if (living.getEntityData().getInteger(NBT_KEY_LAST_MEAL) > living.ticksExisted)
living.getEntityData().setInteger(NBT_KEY_LAST_MEAL, -Time.DAY);
PathNavigate navigate = living.getNavigator();
if (living.getHealth() < living.getMaxHealth() || living.ticksExisted - living.getEntityData().getInteger(NBT_KEY_LAST_MEAL) > Time.DAY) {
List<EntityItem> list = living.world.getEntitiesWithinAABB(EntityItem.class, AABBHelper.getAABBFromEntity(living, 32), this);
list.sort(this);
for (int i = list.size() - 1; i > -1; i--) {
EntityItem item = list.get(i);
navigate.tryMoveToEntityLiving(item, 1);
Path path = navigate.getPath();
if (path != null) {
PathPoint point = path.getFinalPathPoint();
if (item.getPosition().distanceSq(new Vec3i(point.x, point.y, point.z)) < 2) {
meat = item;
return true;
}
}
}
}
return false;
}
示例2: EntityLiving
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public EntityLiving(World par1World)
{
super(par1World);
this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
this.lookHelper = new EntityLookHelper(this);
this.moveHelper = new EntityMoveHelper(this);
this.jumpHelper = new EntityJumpHelper(this);
this.bodyHelper = new EntityBodyHelper(this);
this.navigator = new PathNavigate(this, par1World);
this.senses = new EntitySenses(this);
for (int var2 = 0; var2 < this.equipmentDropChances.length; ++var2)
{
this.equipmentDropChances[var2] = 0.085F;
}
}
示例3: EntityLiving
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public EntityLiving(World p_i1595_1_)
{
super(p_i1595_1_);
this.tasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null);
this.targetTasks = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.theProfiler != null ? p_i1595_1_.theProfiler : null);
this.lookHelper = new EntityLookHelper(this);
this.moveHelper = new EntityMoveHelper(this);
this.jumpHelper = new EntityJumpHelper(this);
this.bodyHelper = new EntityBodyHelper(this);
this.navigator = new PathNavigate(this, p_i1595_1_);
this.senses = new EntitySenses(this);
for (int i = 0; i < this.equipmentDropChances.length; ++i)
{
this.equipmentDropChances[i] = 0.085F;
}
}
示例4: updateTask
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public void updateTask() {
PathNavigate navigator = this.miner.getNavigator();
if (navigator.getPath() != null && navigator.getPath().isFinished()) {
if (this.currentMiningTime > 0) {
this.currentMiningTime--;
}
else {
int x = this.oreLocation.x;
int y = this.oreLocation.y;
int z = this.oreLocation.z;
World world = this.miner.worldObj;
Block block = world.getBlock(x, y, z);
if (shouldMineBlock(block, x, y, z)) {
System.out.println("Miner " + this.miner.getEntityId() + " mined ore!");
ArrayList<ItemStack> items = block.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
for (ItemStack item : items) {
InventoryUtils.addToInventory(item, this.miner.inventory);
}
world.setBlockToAir(x, y, z);
navigator.clearPathEntity();
this.miner.swingItem();
}
}
}
}
示例5: EntityLiving
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public EntityLiving(World p_i1595_1_) {
super(p_i1595_1_);
this.field_70714_bg = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.field_72984_F != null?p_i1595_1_.field_72984_F:null);
this.field_70715_bh = new EntityAITasks(p_i1595_1_ != null && p_i1595_1_.field_72984_F != null?p_i1595_1_.field_72984_F:null);
this.field_70749_g = new EntityLookHelper(this);
this.field_70765_h = new EntityMoveHelper(this);
this.field_70767_i = new EntityJumpHelper(this);
this.field_70762_j = new EntityBodyHelper(this);
this.field_70699_by = new PathNavigate(this, p_i1595_1_);
this.field_70723_bA = new EntitySenses(this);
for(int var2 = 0; var2 < this.field_82174_bp.length; ++var2) {
this.field_82174_bp[var2] = 0.085F;
}
}
示例6: EntityLiving
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public EntityLiving(World par1World)
{
super(par1World);
this.tasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
this.targetTasks = new EntityAITasks(par1World != null && par1World.theProfiler != null ? par1World.theProfiler : null);
this.lookHelper = new EntityLookHelper(this);
this.moveHelper = new EntityMoveHelper(this);
this.jumpHelper = new EntityJumpHelper(this);
this.bodyHelper = new EntityBodyHelper(this);
this.navigator = new PathNavigate(this, par1World);
this.senses = new EntitySenses(this);
for (int i = 0; i < this.equipmentDropChances.length; ++i)
{
this.equipmentDropChances[i] = 0.085F;
}
}
示例7: createNavigator
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
@Override
protected PathNavigate createNavigator(World worldIn) {
EntityPathNavigateDrone nav = new EntityPathNavigateDrone(this, worldIn);
nav.setCanOpenDoors(false);
nav.setCanFloat(true);
nav.setCanEnterDoors(true);
return nav;
}
示例8: shouldExecute
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
@Override
public boolean shouldExecute() {
if (!theEntity.isCollidedHorizontally)
return false;
else {
PathNavigate pathnavigate = theEntity.getNavigator();
PathEntity pathentity = pathnavigate.getPath();
if (pathentity != null && !pathentity.isFinished() && pathnavigate.getCanBreakDoors()) {
for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i) {
PathPoint pathpoint = pathentity.getPathPointFromIndex(i);
entityPosX = pathpoint.xCoord;
entityPosY = pathpoint.yCoord + 1;
entityPosZ = pathpoint.zCoord;
if (theEntity.getDistanceSq(entityPosX, theEntity.posY, entityPosZ) <= 2.25D) {
field_151504_e = func_151503_a(entityPosX, entityPosY, entityPosZ);
if (field_151504_e != null)
return true;
}
}
entityPosX = MathHelper.floor_double(theEntity.posX);
entityPosY = MathHelper.floor_double(theEntity.posY + 1.0D);
entityPosZ = MathHelper.floor_double(theEntity.posZ);
field_151504_e = func_151503_a(entityPosX, entityPosY, entityPosZ);
return field_151504_e != null;
} else
return false;
}
}
示例9: shouldExecute
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
/**
* Returns whether the EntityAIBase should begin execution.
*/
@Override
public boolean shouldExecute() {
PathNavigate pathnavigate = this.theEntity.getNavigator();
// PathEntity pathentity = pathnavigate.getPath();
//
// if (pathentity != null && !pathentity.isFinished()) {
// for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i) {
// PathPoint pathpoint = pathentity.getPathPointFromIndex(i);
// this.entityPosX = pathpoint.xCoord;
// this.entityPosY = pathpoint.yCoord;
// this.entityPosZ = pathpoint.zCoord;
//
// if (this.theEntity.getDistanceSq((double) this.entityPosX, this.theEntity.posY, (double) this.entityPosZ) <= 2.25D) {
// this.targetBlock = this.findBlock(this.entityPosX, this.entityPosY, this.entityPosZ);
//
// if (this.targetBlock != null) {
// return true;
// }
// }
// }
//
// this.entityPosX = MathHelper.floor(this.theEntity.posX);
// this.entityPosY = MathHelper.floor(this.theEntity.posY);
// this.entityPosZ = MathHelper.floor(this.theEntity.posZ);
// this.targetBlock = this.findBlock(this.entityPosX, this.entityPosY, this.entityPosZ);
// return this.targetBlock != null;
// } else {
return false;
// }
}
示例10: renderNavigation
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
private void renderNavigation() {
text.setOrigin(16, 32);
text.setColor(YELLOW);
text.println("Navigation (Ground)");
text.setColor(WHITE);
PathNavigate nav = dragonServer.getNavigator();
PathNavigateGround pathNavigateGround = null;
if (nav instanceof PathNavigateGround) {
pathNavigateGround = (PathNavigateGround) nav;
}
text.println("Search range: " + nav.getPathSearchRange());
text.println("Can swim: " + (pathNavigateGround == null ? "N/A" : pathNavigateGround.getCanSwim()));
text.println("Break doors: " + (pathNavigateGround == null ? "N/A" : pathNavigateGround.getEnterDoors()));
text.println("No path: " + nav.noPath());
Path path = nav.getPath();
if (path != null) {
text.println("Length: " + path.getCurrentPathLength());
text.println("Index: " + path.getCurrentPathIndex());
PathPoint finalPoint = path.getFinalPathPoint();
text.println("Final point: " + finalPoint);
}
text.println();
text.setColor(YELLOW);
text.println("Navigation (Air)");
text.setColor(WHITE);
text.println("Can fly: " + dragonClient.canFly());
text.println("Flying: " + dragonClient.isFlying());
text.println("Altitude: " + dfLong.format(dragonClient.getAltitude()));
}
示例11: setAvoidsWater
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public void setAvoidsWater(boolean avoidWater) {
PathNavigate pathNavigate = dragon.getNavigator();
if (pathNavigate instanceof PathNavigateGround) {
PathNavigateGround pathNavigateGround = (PathNavigateGround) pathNavigate;
pathNavigateGround.setCanSwim(!avoidWater); // originally setAvoidsWater()
}
}
示例12: EventEntityLivingInit
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public EventEntityLivingInit(EntityLiving entity, World world, EntityAITasks tasks, EntityAITasks targetTasks, EntityLookHelper lookHelper, EntityMoveHelper moveHelper, EntityJumpHelper jumpHelper, EntityBodyHelper bodyHelper, PathNavigate navigator, EntitySenses senses)
{
this.entity = entity;
this.world = world;
this.tasks = tasks;
this.targetTasks = targetTasks;
this.lookHelper = lookHelper;
this.jumpHelper = jumpHelper;
this.moveHelper = moveHelper;
this.bodyHelper = bodyHelper;
this.navigator = navigator;
this.senses = senses;
}
示例13: func_75250_a
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
public boolean func_75250_a() {
if(!this.field_75356_a.field_70123_F) {
return false;
} else {
PathNavigate var1 = this.field_75356_a.func_70661_as();
PathEntity var2 = var1.func_75505_d();
if(var2 != null && !var2.func_75879_b() && var1.func_75507_c()) {
for(int var3 = 0; var3 < Math.min(var2.func_75873_e() + 2, var2.func_75874_d()); ++var3) {
PathPoint var4 = var2.func_75877_a(var3);
this.field_75354_b = var4.field_75839_a;
this.field_75355_c = var4.field_75837_b + 1;
this.field_75352_d = var4.field_75838_c;
if(this.field_75356_a.func_70092_e((double)this.field_75354_b, this.field_75356_a.field_70163_u, (double)this.field_75352_d) <= 2.25D) {
this.field_75353_e = this.func_75349_a(this.field_75354_b, this.field_75355_c, this.field_75352_d);
if(this.field_75353_e != null) {
return true;
}
}
}
this.field_75354_b = MathHelper.func_76128_c(this.field_75356_a.field_70165_t);
this.field_75355_c = MathHelper.func_76128_c(this.field_75356_a.field_70163_u + 1.0D);
this.field_75352_d = MathHelper.func_76128_c(this.field_75356_a.field_70161_v);
this.field_75353_e = this.func_75349_a(this.field_75354_b, this.field_75355_c, this.field_75352_d);
return this.field_75353_e != null;
} else {
return false;
}
}
}
示例14: createNavigator
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
@Override
protected PathNavigate createNavigator(World worldIn) {
final PathNavigateGround navigator = new PathNavigateGround(this, worldIn);
setPathPriority(PathNodeType.WATER, -1.0F);
navigator.setCanSwim(true);
return navigator;
}
示例15: getNewNavigator
import net.minecraft.pathfinding.PathNavigate; //導入依賴的package包/類
/**
* Returns new PathNavigateGround instance
*/
protected PathNavigate getNewNavigator(World worldIn)
{
return new PathNavigateGround(this, worldIn);
}