private boolean doesDoorListContain(@Nonnull VillageDoorInfo doorInfoIn) { for (VillageDoorInfo villagedoorinfo : this.doorList) { if (doorInfoIn.getDoorBlockPos().equals(villagedoorinfo.getDoorBlockPos())) { return true; } } return false; }
/** * Resets the task */ @Override public void resetTask() { if (doorInfo != null && (this.theEntity.getNavigator().noPath() || this.theEntity.getDistanceSq(this.doorInfo.getDoorBlockPos()) < 16.0D)) { this.doorList.add(this.doorInfo); } }
/** * Returns whether an in-progress EntityAIBase should continue executing */ @Override public boolean shouldContinueExecuting() { if (this.theEntity.getNavigator().noPath() || this.doorInfo == null) { return false; } else { float f = this.theEntity.width + 4.0F; return this.theEntity.getDistanceSq(this.doorInfo.getDoorBlockPos()) > (double) (f * f); } }
/** * Returns true if the village has a door in the specified chunk. */ public static boolean isVillageDoorInChunk(Village village, Chunk chunk) { int centerX = (chunk.x << 4) + 8; int centerZ = (chunk.z << 4) + 8; if (village.isAnnihilated()) { return true; } for (Object doorInfo : village.getVillageDoorInfoList()) { BlockPos door = ((VillageDoorInfo) doorInfo).getDoorBlockPos(); if ((centerX - door.getX())*(centerX - door.getX()) + (centerZ - door.getZ())*(centerZ - door.getZ()) <= 10*10) { return true; } } return false; } }
boolean flag = pathnavigateground.getEnterDoors(); pathnavigateground.setBreakDoors(false); this.entityPathNavigate = pathnavigateground.getPathToPos(this.doorInfo.getDoorBlockPos()); pathnavigateground.setBreakDoors(flag); Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 10, 7, new Vec3d((double) this.doorInfo.getDoorBlockPos().getX(), (double) this.doorInfo.getDoorBlockPos().getY(), (double) this.doorInfo.getDoorBlockPos().getZ()));
for (VillageDoorInfo villagedoorinfo : this.villageDoorInfoList) { NBTTagCompound nbttagcompound = new NBTTagCompound(); nbttagcompound.setInteger("X", villagedoorinfo.getDoorBlockPos().getX()); nbttagcompound.setInteger("Y", villagedoorinfo.getDoorBlockPos().getY()); nbttagcompound.setInteger("Z", villagedoorinfo.getDoorBlockPos().getZ()); nbttagcompound.setInteger("IDX", villagedoorinfo.getInsideOffsetX()); nbttagcompound.setInteger("IDZ", villagedoorinfo.getInsideOffsetZ());